Commit graph

5258 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
ae5a45be6f
hugolib: Remove unused code 2018-01-25 17:14:03 +01:00
Bjørn Erik Pedersen
4d912e2aad
hugolib, output: Fix robots.txt in multihost mode
Fixes #4193
2018-01-25 10:36:53 +01:00
Bjørn Erik Pedersen
1e27d05891
docs: Re-generate CLI docs 2018-01-25 10:24:59 +01:00
Bjørn Erik Pedersen
d418c2c2ea
Remove and update deprecation status 2018-01-25 10:22:11 +01:00
Bjørn Erik Pedersen
b2fcbb1f97
output: Remove duplicate layout lookup layouts
This can happen for sections if Type and Section are equal.

Of no real practical difference, but it makes the docs less confusing.

Fixes #4319
2018-01-25 09:37:05 +01:00
Bjørn Erik Pedersen
3446fe9b89
hugolib: Add the last lookup variant for the GetPage index
Now, even for nun-bundles it is possible to do lookup without path or extension.

So, given `blog/my-blog-post.en.md` these lookups will succeed:

* `blog/my-blog-post.en.md`
* `blog/my-blog-post`
* `my-blog-post.en.md`
* `my-blog-post`

See #4312
See https://github.com/gohugoio/hugoDocs/issues/307
2018-01-24 13:36:06 +01:00
Bjørn Erik Pedersen
4a7c2b3695
github: Shorten the stale setup 2018-01-24 13:10:44 +01:00
Alexey Grachov
912147ab89 resource: Fix typo in comment 2018-01-24 10:24:21 +01:00
Bjørn Erik Pedersen
517b6b6238 hugolib: Simplify bundle lookup via .Site.GetPage, ref, relref
Given a bundle in `blog/my-bundle/index.en.md` all of these will now worK:

* `blog/my-bundle/index.en.md`
* `blog/my-bundle/index`
* `blog/my-bundle`
* `my-bundle`

The last one is potentially ambigous.

Fixes #4312
2018-01-24 10:05:20 +01:00
Bjørn Erik Pedersen
a19563910e
Add a GetPage to the site benchmarks 2018-01-24 09:08:26 +01:00
Bjørn Erik Pedersen
0432c64dd2 Add headless bundle support
This commit adds  support for `headless bundles` for the `index` bundle type.

So:

```toml
headless = true
```

In front matter means that

* It will have no `Permalink` and no rendered HTML in /public
* It will not be part of `.Site.RegularPages` etc.

But you can get it by:

* `.Site.GetPage ...`

The use cases are many:

* Shared media galleries
* Reusable page content "snippets"
* ...

Fixes #4311
2018-01-24 09:00:21 +01:00
Bjørn Erik Pedersen
5a0819b9b5 Merge matching resources params maps
This allows setting default params values in the more general resource matchers. I also allows override with more specific values if needed.

```toml
[[resources]]
src = "documents/photo_specs.pdf"
title = "Photo Specifications"
[resources.params]
ref = 90564687
icon = "photo"
[[resources]]
src = "documents/guide.pdf"
title = "Instruction Guide"
[resources.params]
ref = 90564568
[[resources]]
src = "documents/checklist.pdf"
title = "Document Checklist"
[resources.params]
ref = 90564572
[[resources]]
src = "documents/payment.docx"
title = "Proof of Payment"
[[resources]]
src = "documents/*.pdf"
title = "PDF file"
[resources.params]
icon = "pdf"
[[resources]]
src = "documents/*.docx"
title = "Word document"
[resources.params]
icon = "word"

```

In the above `TOML` example, `photo_specs.pdf` will get the `photo` icon, the other pdf files will get the default `pdf` icon.

Note that in the example above, the order matters: It will take the first value for a given params key, title or name that it finds.

Fixes #4315
2018-01-23 17:11:38 +01:00
Bjørn Erik Pedersen
78c863305f
Add some general code contribution criterias 2018-01-23 13:33:51 +01:00
Bjørn Erik Pedersen
22ad1ebdbb
travis: Disable macOS builds for now
Travis have not been able to build those the last week or so.
2018-01-23 12:59:40 +01:00
Bjørn Erik Pedersen
ebdd8cba3f
helpers: Avoid unescape in highlight
Fixes #4219
2018-01-23 09:48:04 +01:00
Vas Sudanagunta
8125b4b03d Tighten page kind logic, introduce tests 2018-01-22 13:55:08 +01:00
hugoreleaser
87217d1d0a releaser: Prepare repository for 0.35-DEV
[ci skip]
2018-01-22 12:08:54 +00:00
hugoreleaser
ffd7dc396e releaser: Add release notes to /docs for release of 0.34
[ci skip]
2018-01-22 12:06:38 +00:00
hugoreleaser
2228d3e289 releaser: Bump versions for release of 0.34
[ci skip]
2018-01-22 12:06:38 +00:00
Bjørn Erik Pedersen
5903a9ce10
Release 0.34 2018-01-22 13:02:01 +01:00
hugoreleaser
4d644c9d68 releaser: Add release notes draft for 0.34
Rename to *-ready.md to continue. [ci skip]
2018-01-22 10:40:52 +00:00
Bjørn Erik Pedersen
34a216fe67
resource: Avoid some strings.ToLower in globbing
See #4301
2018-01-22 11:29:33 +01:00
Bjørn Erik Pedersen
adee04f4b4
releaser: Fix BuildDate in release binaries
Fixes #4299
2018-01-22 11:21:58 +01:00
Bjørn Erik Pedersen
9421380168
resource: Add Match and GetMatch
These methods takes a glob pattern as argument:

* by default matching from the bundle root
* matching is case insensitive and the separator is Unix style slashes: "/"
* the bundle root does (by default) not start with a leading slash
* if you renames the `Name` for the rsource in front matter (`src=...`), then that is the value used in `Match`.
* double asterisk matches beyond directory borders, so "**.jpg" will match any JPEG image in the bundle

See https://github.com/gobwas/glob

This commit also deprecates `ByPrefix` and `GetByPrefix`.

This should also be more effective, given a fair amount of reuse of the glob patterns:

```bash
BenchmarkResourcesByPrefix-4         300000          4284 ns/op        1130 B/op           7 allocs/op
BenchmarkResourcesMatch-4            300000          5220 ns/op         505 B/op           3 allocs/op
```

Fixes #4301
2018-01-22 10:28:12 +01:00
Bjørn Erik Pedersen
5d03086981 hugolib: Fix handling of pages bundled in sub-folders in ByPrefix etc.
Fixes #4295
2018-01-21 14:42:54 +01:00
Bjørn Erik Pedersen
07700aab0d
output: Add some more layout docshelper variants 2018-01-19 11:39:34 +01:00
Bjørn Erik Pedersen
4d5e4f379a
hugolib: Add validation for defaultContentLanguage
When `languages` are defined, then `defaultContentLanguage` must match one of those.

Fixes #4298
2018-01-19 08:24:10 +01:00
hugoreleaser
cd77968284 releaser: Prepare repository for 0.34-DEV
[ci skip]
2018-01-18 10:16:12 +00:00
hugoreleaser
c7b9347be0 releaser: Add release notes to /docs for release of 0.33
[ci skip]
2018-01-18 10:13:30 +00:00
hugoreleaser
c6b9037294 releaser: Bump versions for release of 0.33
[ci skip]
2018-01-18 10:13:30 +00:00
Bjørn Erik Pedersen
09a934b321
Release 0.33 2018-01-18 11:09:11 +01:00
hugoreleaser
e6cc2a6551 releaser: Add release notes draft for 0.33
Rename to *-ready.md to continue. [ci skip]
2018-01-18 09:24:11 +00:00
Bjørn Erik Pedersen
a39ae4bb07
output: Redo the docshelper layouts examples 2018-01-18 10:16:21 +01:00
Bjørn Erik Pedersen
b3eeb97642
Merge commit '3cf4300097610bb8b5bd0686d96d1df5db641895' 2018-01-17 22:33:07 +01:00
Bjørn Erik Pedersen
3cf4300097 Squashed 'docs/' changes from ddb7d8fae..56c34962c
56c34962c Fix multilingual config examples
14fa0b4ed Release 0.32.4
18779d54a releaser: Add release notes to /docs for release of 0.32.4
0d47d0673 releaser: Bump versions for release of 0.32.4
424acf02e Release 0.32.3
f6f04e084 releaser: Prepare repository for 0.33-DEV
1a9b36286 releaser: Add release notes to /docs for release of 0.32.3
9284c3284 releaser: Bump versions for release of 0.32.3
796082289 Fix min Go version in installing
74625a654 Add alias to multilingual.md
bf65732b4 Add some new tweets to the front page
7f263353e Bump Netlify to 0.32.2
cbb3a4f1c Update 0.32.2 release notes
e90ae4b4e releaser: Prepare repository for 0.33-DEV
ee74a8f4f releaser: Add release notes to /docs for release of 0.32.2
d889c4fa4 releaser: Bump versions for release of 0.32.2
4a46d3aca Merge commit 'eb738cd35cca1ffc68c5ed688dbe2a19108e8761'
b98d95ff2 releaser: Prepare repository for 0.33-DEV

git-subtree-dir: docs
git-subtree-split: 56c34962c92706792231fd5056d33186b11c4e33
2018-01-17 22:31:25 +01:00
Bjørn Erik Pedersen
9409bc0f79 Improve .Site.GetPage for regular translated pages
You can still use the full path with extensions, but to get the current language version:

* If the content file lives in `/content/blog/mypost.en.md`
* Use `.Site.GetPage "page" "blog/mypost"`

Fixes #4285
2018-01-17 22:27:25 +01:00
Bjørn Erik Pedersen
4eb1650bec
resource: Use path.Match instead of filepath.Match
They behave similar, but it is a path we're matching.

See #4244
2018-01-17 20:48:31 +01:00
Bjørn Erik Pedersen
20c9b6ec81
resource: Add front matter metadata to Resource
This commit expands the Resource interface with 3 new methods:

* Name
* Title
* Params

All of these can be set in the Page front matter. `Name` will get its default value from the base filename, and is the value used in the ByPrefix and GetByPrefix lookup methods.

Fixes #4244
2018-01-17 16:22:33 +01:00
Bjørn Erik Pedersen
f8a119b606
Update Afero to avoid panic on "file name is too long"
Fixes #4240
2018-01-15 20:33:03 +01:00
Bjørn Erik Pedersen
ecaf14514e
resource: Fix handling of very long image file names
Fixes #4261
2018-01-15 20:22:14 +01:00
Bjørn Erik Pedersen
d4f8f88e67
commands: And now really fix the server watch logic
See #4275
2018-01-15 10:02:17 +01:00
Bjørn Erik Pedersen
4e524ffcff
commands: Fix server without watch
This was broken in Hugo 0.30.

Fixes #4275
2018-01-14 20:58:52 +01:00
Bjørn Erik Pedersen
64f0e9d1c1
Update Chroma and other third-party deps
Fixes #4267
2018-01-14 20:32:42 +01:00
Bjørn Erik Pedersen
13d53b31f1
commands: Remove superflous BuildDate logic
Fixes #4272
2018-01-14 20:08:28 +01:00
Bjørn Erik Pedersen
51dd462c39 layout: Respect Type and Layout for list template selection
This commit also has some other nice side-effects:

* The layout logic is unified for all page types, which should make it less surprising
* Page.Render now supports all types
* The legacy "indexes" type is removed from the template lookup order. This is an undocumented type from early Hugo days. This means that having a template in, say, `/layouts/indexes/list.html` will no longer work.
* The theme override logic is improved. As an example, an `index.html` in theme will now wn over a `_default/list.html` in the project, which most will expect.

Fixes #3005
Fixes #3245
2018-01-14 19:59:51 +01:00
Bjørn Erik Pedersen
b6ea6d07d0
Run benchmarks 3 times 2018-01-14 00:49:01 +01:00
Bjørn Erik Pedersen
4dac1781e3
resource: Add some GoDoc 2018-01-13 00:08:21 +01:00
Bjørn Erik Pedersen
8a409894bd hugolib: Allow url in front matter for list type pages
This enables some potential foot-shooting, but is needed for some special URL requirements.

Fixes #4263
2018-01-12 18:10:40 +01:00
Bjørn Erik Pedersen
46db900dab
resource: Implement Resources.ByPrefix
Fixes #4266
2018-01-12 18:06:35 +01:00
Bjørn Erik Pedersen
60c9f3b1c3
resource: Make GetByPrefix work for Page resources
Fixes #4264
2018-01-12 17:46:50 +01:00