Commit graph

4372 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
a5d0a57e6b
output: Fix the shortcodes/partials vs base template detection
Fixes #4897
2018-07-02 10:34:38 +02:00
Anthony Fok
f465571b33
output: gofmt -l -w output/layout.go 2018-07-02 00:08:43 -06:00
Bjørn Erik Pedersen
f8212d2000
tpl/collections: Return en empty slice in after instead of error
When the given index is out of bounds. So it can safely be used with `with` etc. without extra length checking.

Fixes #4894
2018-07-01 20:34:02 +02:00
Bjørn Erik Pedersen
78e8a744b3
Restrict the new type layout resolution to page and section kinds
Will have to test and evaluate this a little.

See  #4891
2018-06-30 16:50:02 +02:00
Bjørn Erik Pedersen
c790029e1d
Consider root and current section's content type if set in front matter
This should allow for less duplication of templates. Before this commit it was possible to override the content page of a given page/section, but only one page at a time.

Full "template sets" can now be inherited by setting `type: blog` etc. in the section content page's front matter, and that type will be considered when looking for layouts for all pages in that section.

For nested sections, it will use consider both `type` set in the current section first, then `type` set in the first section below home, e.g. `/docs`.

This commit also adds a new Page method: `FirstSection`. This navigates up to the first section below home (e.g. `/docs`). For the home page it will return itself.

Fixes #4891
2018-06-30 13:10:04 +02:00
Bjørn Erik Pedersen
554553c09c
circleci: Update docker image
With Go 10.3 and newest Goreleaser and Mage.
2018-06-29 10:46:21 +02:00
Bjørn Erik Pedersen
de37455ec7
hugolib: Allow forward slash in shortcode names
Fixes #4886
2018-06-28 16:06:16 +02:00
Bjørn Erik Pedersen
282f6035e7
Merge branch 'release-0.42.2' 2018-06-28 14:40:23 +02:00
hugoreleaser
360fa12213 releaser: Prepare repository for 0.43-DEV
[ci skip]
2018-06-28 12:38:48 +00:00
hugoreleaser
02aa320030 releaser: Add release notes to /docs for release of 0.42.2
[ci skip]
2018-06-28 12:36:15 +00:00
hugoreleaser
d2640fbc19 releaser: Bump versions for release of 0.42.2
[ci skip]
2018-06-28 12:36:15 +00:00
hugoreleaser
1637d12e37
Release 0.42.2 2018-06-28 14:32:27 +02:00
Bjørn Erik Pedersen
3a7706b069
commands: Fix broken server-reload on config changes
This was accidently broken in Hugo 0.42.

Fixes #4878
2018-06-28 14:08:52 +02:00
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
Carlos Alexandro Becker
1f0c4e1fb3 Update GoReleaser config 2018-06-28 07:54:18 +02:00
Bjørn Erik Pedersen
91ab455d84
tpl: Remove some "debug info"
See #4881
2018-06-26 11:33:12 +02:00
Bjørn Erik Pedersen
ca1e46efb9
tpl: Update internal pagination template to support Bootstrap 4
Fixes #4881
2018-06-26 11:31:46 +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
Anthony Fok
3d5928889a
Revert "tpl: Support text/template/parse API change in go1.11"
Go developers have undone the breaking API changes
in the following commit:

commit bedfa4e1c37bd08063865da628f242d27ca06ec4
Author: Daniel Theophanes <kardianos@gmail.com>
Date:   Thu Jun 21 10:41:26 2018 -0700

    text/template/parse: undo breaking API changes

    golang.org/cl/84480 altered the API for the parse package for
    clarity and consistency. However, the changes also broke the
    API for consumers of the package. This CL reverts the API
    to the previous spelling, adding only a single new exported
    symbol.

    Fixes #25968

    Change-Id: Ieb81054b61eeac7df3bc3864ef446df43c26b80f
    Reviewed-on: https://go-review.googlesource.com/120355
    Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
    Reviewed-by: Rob Pike <r@golang.org>
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>

See https://github.com/golang/go/issues/25968

This reverts commit 9f27091e10.

Closes #4784
Fixes #4873
2018-06-23 15:07:52 -06:00
Bjørn Erik Pedersen
dc7bc7b4d2
appveyor: Disable asciidoctor for now
It fails on installation.
2018-06-23 21:42:21 +02:00
Anthony Fok
42ed602580 hugolib: Replace deprecated {Get,}ByPrefix with {Get,}Match 2018-06-15 09:03:56 +02:00
Brian Fitzgerald
6a2968fd5c Adds .gitattributes to force Go files to LF
Even on Windows machines, we want *.go files to have LF line
endings (go fmt insists). This leaves other files as auto, but
makes *.go files always be LF on Windows machines. With this
change, running go fmt will be a pleasant operation, not a
painful one.

Note that changing .gitattributes only affects files at initial
checkout. To update an entire working directory after making a
change like this, do this (but only after committing all work in
progress, this will destroy uncommitted changes):

$ git rm --cached -r .
$ git reset --hard

Again - do not do this to a working directory with uncommitted
work in it.
2018-06-14 16:08:34 -06:00
Anthony Fok
23d5fc82ee
Update to Go 1.9.7 and Go 1.10.3
for Travis CI, Docker and Snap
2018-06-14 15:50:25 -06:00
Ryan Skoblenick
8531ec7ca3 Update Dockerfile to a multi-stage build
- Hugo container is based on SCRATCH to further reduce the footprint
  and the vulnerability surface
- Update Alpine image to 3.7 in the build container
- Update Go Lang to 1.10 in the build container
- Add .dockerignore file per the Docker best practices

Closes #4154, #4155, #4157
2018-06-14 15:47:04 -06:00
Anthony Fok
9f27091e10 tpl: Support text/template/parse API change in go1.11
Thanks to @rjoleary for the investigation.

Fixes #4784
2018-06-14 08:58:42 +02:00
hugoreleaser
187621ae24 releaser: Prepare repository for 0.43-DEV
[ci skip]
2018-06-13 10:19:00 +00:00
hugoreleaser
4172a835e5 releaser: Add release notes to /docs for release of 0.42.1
[ci skip]
2018-06-13 10:16:33 +00:00
hugoreleaser
fc97388968 releaser: Bump versions for release of 0.42.1
[ci skip]
2018-06-13 10:16:33 +00:00
Bjørn Erik Pedersen
d67e843c12
Release 0.42.1 2018-06-13 12:11:30 +02:00
hugoreleaser
6e33c557b0 releaser: Add release notes draft for 0.42.1
Rename to *-ready.md to continue. [ci skip]
2018-06-13 10:09:45 +00:00
Bjørn Erik Pedersen
128f14efad hugolib: Reset the global pages cache on server rebuilds
In Hugo 0.42, this could lead to errors of type `runtime error: invalid memory address or nil pointer dereference` in some rare situations.

Note that this was also an issue before 0.42, but the symptom was then potentially stale list content on rebuilds on content changes.

This commit also improves the above error message.

Fixes #4845
2018-06-13 12:00:30 +02: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
hugoreleaser
0f1fc01ef2
releaser: Prepare repository for 0.43-DEV
[ci skip]
2018-06-12 08:45:06 +02:00
Bjørn Erik Pedersen
f32ccd018f
Merge tag 'v0.42'
releaser: 0.42 [ci skip]
2018-06-12 08:42:25 +02:00
hugoreleaser
ffb609f4ab releaser: Add release notes to /docs for release of 0.42
[ci skip]
2018-06-12 06:37:19 +00:00
hugoreleaser
19d91abc92 releaser: Bump versions for release of 0.42
[ci skip]
2018-06-12 06:37:19 +00:00
Bjørn Erik Pedersen
f5c0a2b4b2
Release 0.42 2018-06-12 08:32:10 +02:00
hugoreleaser
31828026a1 releaser: Add release notes draft for 0.42
Rename to *-ready.md to continue. [ci skip]
2018-06-12 05:50:33 +00:00
Bjørn Erik Pedersen
c74b0f8f9b
docs: Update theme documentation
See #4460
2018-06-12 07:38:41 +02:00
Bjørn Erik Pedersen
80949dc73f
docs: Remove some files now moved 2018-06-12 06:43:21 +02:00
Bjørn Erik Pedersen
e02629f81a
Merge commit 'b239595af5a9fc1fc9a1ccc666c3ab06ccc32f04' 2018-06-11 22:32:19 +02:00
Bjørn Erik Pedersen
b239595af5 Squashed 'docs/' changes from 0fd7b4169..501c6e233
501c6e233 Remoe speakerdeck example
9529bd27d Fix typos
530f22cd3 Remove language assuming knowledge of GitHub OAuth
c618809e7 Refer to Go by its proper name, not its domain name
06e23168b Add timeout parameter to configuration docs
034fa62a7 Update shortcodes.md
10ea79335 Document .Ordinal on shortcode
0bfd85fb9 Formatting
e44f80fdf Release 0.41
76164258c releaser: Add release notes to /docs for release of 0.41
8d87505eb releaser: Bump versions for release of 0.41
2bbc003ee docs: Document the GDPR Privacy Config
e2d11564d Merge commit 'd2b1030060d3c91d5f9ffa3456418da16bd74f1d'

git-subtree-dir: docs
git-subtree-split: 501c6e23370fae21e2110e0d7ea0db6731b31779
2018-06-11 22:31:02 +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
6464981adb
hugolib: Make sure that .Site.Taxonomies is always set on rebuilds
Fixes #4838
2018-06-10 20:55:17 +02:00
Christian Oliff
2e6712e281 tpl: Always load GA script over HTTPS 2018-06-09 23:47:44 +02:00