Commit graph

580 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
2955f93fc6
commands: Fix broken server-reload on config changes
This was accidently broken in Hugo 0.42.

Fixes #4878
2018-06-28 12:22:00 +02:00
openscript
fd71fa89bd Create missing head.html partial on new theme generation 2018-06-25 12:06:45 -06:00
openscript
b5a3aa7082 Add html doctype to baseof.html template for new themes 2018-06-25 12:06:45 -06:00
Bjørn Erik Pedersen
34ee27a78b
commands: Do not fail server build when /static is missing
This was a un-intended change in Hugo 0.42. Most sites will have a static directory so this should not be a big issue, but this commit will revert back to old behaviour.

Fixes #4846
2018-06-13 08:48:20 +02:00
Anthony Fok
ed4a345efe commands: Create LICENSE rather than LICENSE.md in "new theme"
See also #4623
2018-06-11 10:40:22 +02:00
Anthony Fok
9717ac7dce commands: Create _default/baseof.html in "new theme"
Thanks to @digitalcraftsman, @bep and @rdwatters for providing the
actual content of the default baseof.html file.

Fixes #3576
2018-06-11 10:40:22 +02:00
Anthony Fok
692ec00872 commands: Make "new theme" feedback more intuitive 2018-06-11 10:40:22 +02:00
Anthony Fok
d3dd74fd65 commands: Move nextStepsText() to new_site.go 2018-06-11 10:40:22 +02:00
Bjørn Erik Pedersen
80230f26a3
Add support for theme composition and inheritance
This commit adds support for theme composition and inheritance in Hugo.

With this, it helps thinking about a theme as a set of ordered components:

```toml
theme = ["my-shortcodes", "base-theme", "hyde"]
```

The theme definition example above in `config.toml` creates a theme with the 3 components with presedence from left to right.

So, Hugo will, for any given file, data entry etc., look first in the project, and then in `my-shortcode`, `base-theme` and lastly `hyde`.

Hugo uses two different algorithms to merge the filesystems, depending on the file type:

* For `i18n` and `data` files, Hugo merges deeply using the translation id and data key inside the files.
* For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen.

The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are  plans to improve on this and get a URL scheme so this can be resolved automatically.

Also note that a component that is part of a theme can have its own configuration file, e.g. `config.toml`. There are currently some restrictions to what a theme component can configure:

* `params` (global and per language)
* `menu` (global and per language)
* `outputformats` and `mediatypes`

The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts.

A final note: Themes/components can also have a `theme` definition in their `config.toml` and similar, which is the "inheritance" part of this commit's title. This is currently not supported by the Hugo theme site. We will have to wait for some "auto dependency" feature to be implemented for that to happen, but this can be a powerful feature if you want to create your own theme-variant based on others.

Fixes #4460
Fixes #4450
2018-06-10 23:55:20 +02:00
Bjørn Erik Pedersen
bf5f10faa9 Reset the "distinct error logger" on rebuilds
Fixes #4818
2018-06-05 10:45:24 +03:00
Bjørn Erik Pedersen
35ccf06dae
Fix some recently broken embedded templates
And add tests for them.

Fixes #4757
2018-05-23 10:03:11 +02:00
Lorenz Cuno Klopfenstein
568b4335c2 commands: Avoid ANSI character output on Windows
Fixes #4462
2018-05-22 17:15:19 +02:00
Anthony Fok
4eedb377b6
commands: Do not show empty BuildDate in version 2018-05-14 00:08:12 -06:00
Bjørn Erik Pedersen
f21b827f7b
commands: Re-add the missing releaser command 2018-04-16 08:23:32 +02:00
Bjørn Erik Pedersen
1b4e0c4161 commands: Remove accidental and breaking space in baseURL flag
And added key-trimming to prevent future mishaps.

See #4607
2018-04-15 11:20:04 +02:00
Bjørn Erik Pedersen
27a524b090 commands: Properly handle CLI slice arguments
Like `--disableKinds` -- this handling was kind of broken when we recently moved this from global vars

See #4607
2018-04-14 11:32:25 +02:00
Bjørn Erik Pedersen
bede93de00 commands: Correctly handle destination and i18n-warnings
And add some more CLI tests.

See #4607
2018-04-14 11:32:25 +02:00
Bjørn Erik Pedersen
2aab6dee85 commands: Fix handling of persistent CLI flags
See #4607
2018-04-13 09:08:49 +02:00
Bjørn Erik Pedersen
9c782d5147
commands: Fix failing Travis server test 2018-04-12 09:31:53 +02:00
Bjørn Erik Pedersen
96689a5c31
commands: Make commands.Execute return a Response object
We have no global `Hugo` object no more (yay!), and there are some external tools that depends on that value.

These tools need to use get that value from `Response.Result`.

Note that `commands.Execute` now also takes the arguments as a string slice. This should also make it easier to use, not having to modify `os.Args`.

This commit also wraps up this particular issue. Phew!

Test coverage in /commands before: 14.4%
Now:  53.5%

Still work to do, now it is at least possible.

Closes #4598
2018-04-11 20:37:08 +02:00
Bjørn Erik Pedersen
e7010c1b62
commands: Remove some TODOs
See #4598
2018-04-11 10:16:30 +02:00
Bjørn Erik Pedersen
f396cffa23
commands: Fix the config command
It now also accepts the `-s` (source) flag.

See #4598
2018-04-11 10:09:45 +02:00
Bjørn Erik Pedersen
24d5c21942
commands: Fix some flag diff
The CLI docs output is now identical with the master version.

See #4598
2018-04-11 09:57:43 +02:00
Bjørn Erik Pedersen
a7d00fc39e
commands: Add basic server test
See #4598
2018-04-11 09:51:07 +02:00
Bjørn Erik Pedersen
1e233b1c45
commands: Fix TestFixURL
See #4598
2018-04-11 09:50:19 +02:00
Bjørn Erik Pedersen
b110d0ae04
commands: Remove the Hugo global
There are still some cleaning to do, but that felt good.

See #4598
2018-04-11 09:50:19 +02:00
Bjørn Erik Pedersen
73825cfc1c
commands: Make the limit command work again
See #4598
2018-04-11 09:50:19 +02:00
Bjørn Erik Pedersen
a8f7fbbb10
commands: Move the commands related logic to its own file
See #4598
2018-04-11 09:50:19 +02:00
Bjørn Erik Pedersen
e8d6ca9531
commands: Add CLI tests
See #4598
2018-04-11 09:50:19 +02:00
Bjørn Erik Pedersen
4d32f2fa89
commands: Make the hugo command non-global
See #4598
2018-04-11 09:50:19 +02:00
Bjørn Erik Pedersen
018602c46d
commands: Extract some common types into its own file
See #4598
2018-04-11 09:50:19 +02:00
Bjørn Erik Pedersen
2f0d98a19b
commands: Make the server command non-global
See #4598
2018-04-11 09:50:18 +02:00
Bjørn Erik Pedersen
e0621d207c
commands: Make the gen commands non-global
See #4598
2018-04-11 09:50:18 +02:00
Bjørn Erik Pedersen
e26a8b242a
commands: Make the list commands non-global
See #4598
2018-04-11 09:48:56 +02:00
Bjørn Erik Pedersen
2a2c983867
commands: Make the import commands non-global
See #4598
2018-04-11 09:48:56 +02:00
Bjørn Erik Pedersen
15b1e269ad
comands: Make the config command non-global
See #4598
2018-04-11 09:48:56 +02:00
Bjørn Erik Pedersen
56a1308044
commands: Make the new commands non-global
See #4598
2018-04-11 09:48:56 +02:00
Bjørn Erik Pedersen
4b780ca778
commands: Make convert command non-global
See #4598
2018-04-11 09:48:56 +02:00
Bjørn Erik Pedersen
7bc5e89fba
commands: Make more commands non-global
See #4598
2018-04-11 09:48:56 +02:00
Bjørn Erik Pedersen
fdf1d94ebc
commands: Make benchmark non-global
See #4598
2018-04-11 09:48:56 +02:00
Bjørn Erik Pedersen
1157fef859
commands: Start of flag cleaning
See #4598
2018-04-11 09:48:55 +02:00
Bjørn Erik Pedersen
e614d8a57c
commands: Use short date format in CLI docs
To make it possible to compare the output.

See #4598
2018-04-11 09:48:34 +02:00
hugoreleaser
d7f47b780c releaser: Prepare repository for 0.39-DEV
[ci skip]
2018-04-09 08:19:32 +00:00
hugoreleaser
62e7588262 releaser: Bump versions for release of 0.38.2
[ci skip]
2018-04-09 08:17:14 +00:00
Bjørn Erik Pedersen
719251c1af
Bump the debouncer dependency
No practical difference.
2018-04-08 10:20:39 +02:00
Bjørn Erik Pedersen
080302eb87
Fix handling of --contentDir etc. flag
We need to revisit the commands package re globals and tests, but this should fix the init order of flags and languages.

Fixes #4589
2018-04-07 16:40:45 +02:00
hugoreleaser
e7d87e2410 releaser: Prepare repository for 0.39-DEV
[ci skip]
2018-04-05 16:39:05 +00:00
hugoreleaser
3a96fa40bf releaser: Bump versions for release of 0.38.1
[ci skip]
2018-04-05 16:35:25 +00:00
Bjørn Erik Pedersen
730b66b652
commands: Handle mass content etc. edits in server mode
Fixes #4563
2018-04-04 09:29:59 +02:00
hugoreleaser
20e9c08e1f releaser: Bump versions for release of 0.38
[ci skip]
2018-04-02 11:03:32 +00:00