Compare commits

...

129 Commits

Author SHA1 Message Date
hugoreleaser 0283db6c60 releaser: Add release notes to /docs for release of 0.35
[ci skip]
2018-01-31 10:44:41 +00:00
hugoreleaser 58188807aa releaser: Bump versions for release of 0.35
[ci skip]
2018-01-31 10:44:41 +00:00
Bjørn Erik Pedersen 51d5c5421e Release 0.35 2018-01-31 11:41:19 +01:00
Bjørn Erik Pedersen a9a5b1e094 docs: Regenerate CLI docs 2018-01-31 11:40:30 +01:00
hugoreleaser cf5c2df81c releaser: Add release notes draft for 0.35
Rename to *-ready.md to continue. [ci skip]
2018-01-31 11:40:03 +01:00
Bjørn Erik Pedersen 158e1151cd Merge commit '337d0c5f516ee085205e8abefdb7f87e6d33ca05' 2018-01-31 11:08:08 +01:00
Bjørn Erik Pedersen 337d0c5f51 Squashed 'docs/' changes from 56c34962c..dce236ad1
dce236ad1 Wrap up the bundle etc. edits for now
27d058566 Add the bundle tree to the organization bundle
a83f750dd Move organization.md to its own bundle
01ec4f462 Make the image docs a bundle
60de1e090 Some more resources copy-edits
05d763c0c Some resource copy-edits
6299d6dbb Update the imgproc shortcode
59e0fc209 Add headless bundle documentation
a3bbf60bf Link Page Resources page from Front Matter page
830576f86 Update order significance section, add counter section
3b1836509 Revert the recent change made to default list template
886ed0e10 Page Bundles draft rev 2
f530d1a7a image processing and page resources made into regular .md
ec47cecda Finalised Page Resources and Image Processing Moved Page Resources and Impage Processing out of the Bundle section and at the root of the Content Management section
253092335 Modified front matter metadata exemple. Added yaml version.
da5e4f476 Adding date in the front-matter; missed in previous commit
6bc3ced13 Add rough draft for page and section bundles
a0e44458f Image processing first draft, Resources second read/fix
2367f0b78 data: Remove duplicate layouts in table
c2f179839 First draft of bundles/resources (covers resources and metadata)
2a3f9a613 Add weights to pages in Bundles branch
9a0146cc0 Switch front-matter format of Bundles doc to yaml; add front-matter
1295fc083 First draft for Bundles documentation organization structure
5a2e52231 Fix archetype paths
9c2e5c063 Merge commit '22cced34fc608256f8271ad591a5ccca991bb164'
22cced34f Squashed 'themes/gohugoioTheme/' changes from 75da2f6b..ecad8247
55d16c9a1 Fix broken sentence in multilingual sections
a76895ad2 Replace the outdated Emacs package with new one
e6cf1dec0 Remove obsolete link to hugo roadmap
dd2fd145b Add GitLab Pages to mentioned hosters (#309)
a05ce6bf6 Add 0.34 release notes poster
5c0ebdfca Release 0.34
13c2f3dc8 Merge branch 'temp34'
e6b5ffa04 Add 0.34 poster
1e1960496 releaser: Add release notes to /docs for release of 0.34
ac3efe182 releaser: Bump versions for release of 0.34
8f91f62d8 Fixes #222
cca35dbe4 Fix example
eaaa21ca1 Add missing params key
00d0b0363 Adding new Blogger utility to tools/migrations
7d36d579e Updated the line number for Dockerfile pointer
852188f85 Update installing.md with Fedora instructions
4d151a3ab Update search.md
4c2750bfb Update deployment-with-nanobox.md
c3cc9cd49 configuration: Remove defaultExtension from docs
f7c96b4b5 Update GitHub Pages documentation
55787f09a Merge branch 'rmetzler-menu-link-title'
2abbd9bd9 Merge branch 'master' into menu-link-title
e1fd710b7 Bring archetypes in from theme.
daf6f51c0 Mention the significance of leading 0 in int fn string input
07f498755 Add documentation for `cond` function.
050ccd12b Add documentation for the .HasShortcode function
919af9071 Correct anchor under 'Add custom metadata to a Taxonomy Term'
55600b4ff More layouts work
201cf4f67 Add some more single page layout variants
d5e7c03e2 Rework the layouts doc
84622e67c Cleans up the code sample
c231c9bd5 Add a new note to 0.33 relnotes
328ec9930 Release 0.33
b108fcc7b Merge branch 'temp33' into next
ab9d9ee65 releaser: Prepare repository for 0.34-DEV
e20c75320 releaser: Add release notes to /docs for release of 0.33
49f24dcd1 releaser: Bump versions for release of 0.33
9c8e5e207 Update 0.33 poster
7655603c8 Regenerate the docshelper data
16dc99583 Add Hugo 0.33 poster
ce40cc197 Merge commit '3cf4300097610bb8b5bd0686d96d1df5db641895'
9a3085523 releaser: Prepare repository for 0.33-DEV
a52db97d8 fixing typos and syntax for consistency
64525670f ádd title to some menu entries. This needs hugo >= v0.32
85d415ab2 ádd examples for menu .Title and .Page

git-subtree-dir: docs
git-subtree-split: dce236ad12
2018-01-31 11:07:47 +01:00
Anthony Fok f0c0ece44d Add "removable-media" interface to snapcraft.yaml
Closes #3837
2018-01-31 02:00:16 -07:00
Ryan Skoblenick a34213f0b5 Fix Docker build
The present Dockerfile in master does not build a Hugo container. The
build container prematurely exits because `dep ensure` can not locate
`Gopkg.toml` due to the source files not being copied/added to the
container prior to running this command. The minimal change require
to resolve the issue is merely move the ADD source before the RUN dep.

Fixes #4076
Resolves #4077
2018-01-31 09:16:28 +01:00
Bjørn Erik Pedersen fe40823de0 readme: Update list of "builders" to include myself 2018-01-30 19:56:29 +01:00
Bjørn Erik Pedersen ae742cb1bd Fix language params handling
This fixes some issues with language params handling by separating params from configuration values per language.

This means that you can now do this:

```toml
[languages]
[languages.en]
languageName = "English"
weight = 1
title = "My Cool Site"
[languages.en.params]
myParam = "Hi!"
```

This is not a breaking change, but the above is a less suprising way of configuring custom params.

It also fixes some hard-to-debug corner-cases in multilingual sites.

Fixes #4356
Fixes #4352
2018-01-30 18:53:07 +01:00
Bjørn Erik Pedersen feeed073c3 commands: Remove some now superflous Fast Render Mode code
Updates #4339
2018-01-30 10:49:24 +01:00
Bjørn Erik Pedersen 94e736c5e1 hugolib: Extract the Fast Render Mode logic into a method
This also improves on the previous commit as it takes pages without content files into account.

Closes #4339
2018-01-30 10:49:24 +01:00
Alexey Grachov 1707dae8d3 hugolib: Handle newly created files in Fast Render Mode
Updates #4339
2018-01-30 10:49:24 +01:00
Robert Basic 2fa70c9344 command: Remove undraft command
According to @bep, it is easier to undraft content by
editing manually the frontmatter of said content by
setting the draft flag to `false`, or removing it completely,
than to rely on the undraft command which is a source of
many bugs.

Fixes #4353
2018-01-29 16:56:35 +01:00
Bjørn Erik Pedersen b6f3f087aa commands: Mark deprecated flags in the CLI help
See #4347
2018-01-29 14:07:46 +01:00
Bjørn Erik Pedersen adfd4370b6 hugolib: Deprecate useModTimeAsFallback
Fixes #4351
2018-01-29 13:52:04 +01:00
Bjørn Erik Pedersen 25d691daff tpl: Update Twitter card to also consider images in .Resources
The new lookup order:

1) Page.Params.images if set
2) Image resources: images with name "feature" (priority), "cover", "thumbnail"
3) Site.Params.images if set

Fixes #4349
2018-01-29 11:44:41 +01:00
Bjørn Erik Pedersen df20b05463 resource: Make resource counters for name and title independent
This is the most flexible with the current syntax, and probably what most people would expcect.

Updates #4335
2018-01-29 10:44:09 +01:00
Bjørn Erik Pedersen 863a812e07 create: Provide .Name to the archetype templates
This value will have a better suited value to base the titles on in your archetype templates when creating bundle ´index.md` type of files.

The internal template is updates, but you will have to update any custom archetype template to use the new `.Name` variable:

```bash
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---
```

Fixes #4348
2018-01-28 19:41:55 +01:00
Bjørn Erik Pedersen f08ea02d24 commands: Deprecate CLI flags canonifyURLs, pluralizeListTitles, preserveTaxonomyNames, uglyURLs
You can of course still set them in site config.

Fixes #4347
2018-01-28 17:22:08 +01:00
Bjørn Erik Pedersen 016398ffe2 hugolib: Fix --uglyURLs from comand line regression
This bug was introduced in Hugo 0.33.

Fixes #4343
2018-01-28 17:03:10 +01:00
Colin Seymour 3752348ef1 Only set 'url' if permalink in metadata and remove duplicate confirm msg
The current behaviour addes a `url` attribute to the frontmatter of all posts imported from Jeklly and assumes the desired permalink structure is /:year/:month/:day/:title/. This may be the case for most peeps, but poses a problem for those that don't use this permalink structure as the `url` attribute takes precedence over the `permalink` attribute in the site-wide configuration meaning it can't be overruled.

This changes the behaviour to only set the `url` attribute if the `permalink` attribute is set in the Jekyll frontmatter.

The duplication of the confirmation message is also removed.

Tests have been updated to reflect this change in behaviour.

Fixes #1887
2018-01-28 11:24:31 +01:00
Bjørn Erik Pedersen 4eb2fec67c Fix handling of top-level page bundles
Fixes #4332
2018-01-27 19:13:34 +01:00
liguoqinjim 83c761b71a tpl/collections: Seed random on init only 2018-01-27 18:51:12 +01:00
Bjørn Erik Pedersen ed4a00e46f commands: Fix baseURL server regression for multilingual sites
This was introduced in 6413559f75 a couple of days ago, and demonstrates that we really need better tests for the server/commands package.

Fixes #4333
2018-01-27 10:58:30 +01:00
Bjørn Erik Pedersen 7b472e4608 resource: Start Resources :counter first time they're used
This is less surprising and more flexible than the original implementation.

Given:

```toml
[[resources]]
  src = "documents/photo_specs.pdf"
  title = "Photo Specifications"
[[resources]]
  src = "**.pdf"
  name = "pdf-file-:counter"
```

Every `pdf` in the bundle will have an unique counter, but the `photo_specs.pdf` is still allowed to have its specific `title`.

If you change the above example to:

```toml
[[resources]]
  src = "documents/*specs.pdf"
  title = "Photo Specifications #:conter"
[[resources]]
  src = "**.pdf"
  name = "pdf-file-:counter"
```

We are talking about two different groups of documents, each with its own counters starting at 1.

Fixes #4335
2018-01-27 10:22:42 +01:00
Bjørn Erik Pedersen 96e3fbcf23 travis: Re-enable macOS builds 2018-01-26 17:08:32 +01:00
Bjørn Erik Pedersen a91aba1c15 Update to Go 1.9.3
Fixes #4328
2018-01-26 17:07:08 +01:00
Bjørn Erik Pedersen 6413559f75 Add a way to disable one or more languages
This commit adds a new config setting:

```toml
disableLanguages = ["fr"]
```

If this is a multilingual site:

* No site for the French language will be created
* French content pages will be ignored/not read
* The French language configuration (menus etc.) will also be ignored

This makes it possible to start translating new languages and turn it on when you're happy etc.

Fixes #4297
Fixed #4329
2018-01-26 14:04:14 +01:00
Vas Sudanagunta 322c567220 Fix "date" page param
Add test coverage for all date type page params that shadow date type page variables.

Fixes #4323
2018-01-26 09:17:27 +01:00
Vas Sudanagunta 91bb774ae4 Support pages without front matter
* Page without front matter now treated same as a page with empty front matter.
* Test cases added to cover this and repro issue #4320.
* Type safety of front matter code improved.

Fixes #4320
2018-01-26 09:17:27 +01:00
Vas Sudanagunta 3f0379adb7 Add page metadata dates tests 2018-01-26 09:17:27 +01:00
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: 56c34962c9
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
Bjørn Erik Pedersen 57e10f174e Support uglyURLs per section
Fixes #4256
2018-01-12 10:39:09 +01:00
Bjørn Erik Pedersen db85e83403 resource: Make .Resources.GetByPrefix case insensitive
Fixes #4258
2018-01-11 18:58:53 +01:00
Vas Sudanagunta 1046e9363f Update CONTRIBUTING.md 2018-01-11 17:22:12 +01:00
Vas Sudanagunta d5803da1be Support offline builds 2018-01-11 17:22:12 +01:00
hugoreleaser 27c77e1ab9 releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-11 09:00:51 +00:00
hugoreleaser 218773a82b releaser: Add release notes to /docs for release of 0.32.4
[ci skip]
2018-01-11 08:58:01 +00:00
hugoreleaser a97ef61bad releaser: Bump versions for release of 0.32.4
[ci skip]
2018-01-11 08:58:01 +00:00
Bjørn Erik Pedersen 4aaf27dc55 Release 0.32.4 2018-01-11 09:52:32 +01:00
hugoreleaser f7d0b05f93 releaser: Add release notes draft for 0.32.4
Rename to *-ready.md to continue. [ci skip]
2018-01-11 08:48:10 +00:00
Bjørn Erik Pedersen f82428d2e0 releaser: Git info bounds checking 2018-01-11 09:39:42 +01:00
Bjørn Erik Pedersen 50fb49c3d9 resource: Remove superflous comment 2018-01-11 09:17:48 +01:00
Alexander Borsuk 5235a5bf5e Correct fix for --cleanDestinationDir flag
Fixes #4246
Fixes #4248
2018-01-10 18:26:42 +01:00
Alexander Borsuk 1921a70ab1 Revert "Remove the --cleanDestinationDir flag", there is a better fix.
This reverts commit 768ec5df9f.
2018-01-10 18:26:42 +01:00
Bjørn Erik Pedersen f0eecc6a4f Fix non-ASCII path handling for Page resources
Fixes #4241
2018-01-10 18:23:41 +01:00
Bjørn Erik Pedersen 768ec5df9f Remove the --cleanDestinationDir flag
This is no longer supported. Since Hugo 0.32 we do static sync and build in parallel.

Closes #4246
2018-01-10 09:34:40 +01:00
hugoreleaser 238e7f7fbe releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-08 11:12:41 +00:00
hugoreleaser 0aaa38544d releaser: Add release notes to /docs for release of 0.32.3
[ci skip]
2018-01-08 11:10:08 +00:00
hugoreleaser fdec5e3084 releaser: Bump versions for release of 0.32.3
[ci skip]
2018-01-08 11:10:08 +00:00
Bjørn Erik Pedersen 71abb53fff Release 0.32.2 2018-01-08 12:05:52 +01:00
hugoreleaser db5d79862b releaser: Add release notes draft for 0.32.3
Rename to *-ready.md to continue. [ci skip]
2018-01-08 10:57:07 +00:00
Bjørn Erik Pedersen 2d3189b227 hugolib: Fix handling of mixed-case taxonomy folders with content file
* We match by path vs taxonomy to determine if we have a content page for that taxonomy
* The taxonomy name is (if `preserveTaxonomyNames` is not set) normalized to `maxmustermann` while you have the disk folder called `MaxMustermann`.
* This isn't a new issue, but I suspect most people will just name the folder `authors/maxmustermann` and it will just work.
* The inconsistent behaviour you see here is that you will end up with two pages with the same target filename, so it is a little random who will win.

This fixes that by also normalizing the taxonomy path when doing the comparison.

Fixes #4238
2018-01-08 11:47:26 +01:00
Bjørn Erik Pedersen 4b04db0f08 resource: Avoid processing and storing same image for each language
Fixes #4231
2018-01-07 11:58:16 +01:00
Bjørn Erik Pedersen 97c1866e32 resource: Resources.ByType should return Resources
Currently it returns []Resource.

This way the invocations can be nested.

Fixes #4234
2018-01-07 10:53:45 +01:00
Bjørn Erik Pedersen 8969331f5b Fix multihost detection for sites without language definition
Static content was wrongly put into the lang-code subfolder.

Fixes #4221
2018-01-06 19:14:31 +01:00
Bjørn Erik Pedersen 6feb138785 commands: Report build time on config.toml change
Fixes #4232
See #4224
2018-01-06 10:54:16 +01:00
Bjørn Erik Pedersen 059e8458d6 Fix hugo benchmark --renderToMemory
Fixes #4218
2018-01-06 10:37:04 +01:00
Bjørn Erik Pedersen ab82a27d05 Fix URLs for bundle resources in multihost mode
Fixes #4217
2018-01-06 10:29:13 +01:00
Bjørn Erik Pedersen f25d8a9e17 Fix sub-folder baseURL handling for Page resources
I.e. images etc.

Fixes #4228
2018-01-06 10:29:13 +01:00
hugoreleaser 54a89cde69 releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-03 09:56:18 +00:00
hugoreleaser 2cd962233f releaser: Add release notes to /docs for release of 0.32.2
[ci skip]
2018-01-03 09:54:04 +00:00
hugoreleaser 865877cd05 releaser: Bump versions for release of 0.32.2
[ci skip]
2018-01-03 09:54:04 +00:00
Bjørn Erik Pedersen 1ff80a8bbe Release 0.32.2 2018-01-03 10:50:57 +01:00
hugoreleaser 956ef40978 releaser: Add release notes draft for 0.32.2
Rename to *-ready.md to continue. [ci skip]
2018-01-03 09:49:11 +00:00
Bjørn Erik Pedersen 196da49c9d resource: Handle publish to /public on fresh build
Fixes #4213
2018-01-03 10:28:16 +01:00
Bjørn Erik Pedersen 2aa4c009ee Merge commit 'eb738cd35cca1ffc68c5ed688dbe2a19108e8761' 2018-01-03 10:19:56 +01:00
Bjørn Erik Pedersen eb738cd35c Squashed 'docs/' changes from fc61378a3..ddb7d8fae
ddb7d8fae Fix spelling in error message
84f7e09ff Add an "sharing image" to the 0.32 doc
a6d39884c Add image processing examples
717e25400 Release 0.32.1
07a4fc1c1 Merge branch 'temp321'
401ed894b releaser: Add release notes to /docs for release of 0.32.1
aa040d965 releaser: Bump versions for release of 0.32.1
6d22558ec Close shortcode
442afa7f5 Add a link to the 0.32 HOWTO with a searchable title
9a9a7e475 Add a note about the shortcode issue
76d731ce2 Add title etc. to release notes
eac596de8 Release v0.32
ede3e25dc Merge branch 'tmp32'
c92f1701b releaser: Prepare repository for 0.33-DEV
e498e97f9 releaser: Add release notes to /docs for release of 0.32
1d476fc59 Fix typo
9bac78a2f Merge commit 'f3cd083961f36dc96d05e98aaf67f650102bc757'
7d8c78391 Add Pandoc support, refactor external helpers

git-subtree-dir: docs
git-subtree-split: ddb7d8fae0
2018-01-03 10:16:56 +01:00
hugoreleaser 3dd8c1c026 releaser: Prepare repository for 0.33-DEV
[ci skip]
2018-01-02 09:10:11 +00:00
hugoreleaser fd301c3c05 releaser: Add release notes to /docs for release of 0.32.1
[ci skip]
2018-01-02 09:07:55 +00:00
hugoreleaser 54ef60b03a releaser: Bump versions for release of 0.32.1
[ci skip]
2018-01-02 09:07:55 +00:00
Bjørn Erik Pedersen 14a758ff24 Release Hugo 0.32.1 2018-01-02 10:04:51 +01:00
hugoreleaser e64eb5ec2b releaser: Add release notes draft for 0.32.1
Rename to *-ready.md to continue. [ci skip]
2018-01-02 08:59:40 +00:00
Bjørn Erik Pedersen d36d71edd3 commands: Fix broken hugo --renderToMemory
The `--renderToMemory` flag stopped working on `hugo` in 0.32.

Note that this is only useful for benchmark testing, as there is no easy way to actually view the result.

Fixes #4212
2018-01-02 09:40:58 +01:00
Bjørn Erik Pedersen a54fd7df21 resource: Use the correct Destination FS
Source and destination will be the same when this happens, but it should be correct.

See #4202
2018-01-01 14:28:19 +01:00
Bjørn Erik Pedersen 16e1d99c6d resource: Create target dir if not exists
This is the case where image processing is triggered from shortcodes, i.e. before the target page's folder in /public is created.

Fixes #4202
2018-01-01 14:23:51 +01:00
Bjørn Erik Pedersen bf8a61fde5 hugolib: Add test for image processing from shortcodes
See #4202
2018-01-01 12:11:36 +01:00
hugoreleaser 72158ab2e8 releaser: Prepare repository for 0.33-DEV
[ci skip]
2017-12-31 09:26:48 +00:00
190 changed files with 4827 additions and 2185 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: /go/src/github.com/gohugoio
docker:
- image: bepsays/ci-goreleaser:0.34.2-6
- image: bepsays/ci-goreleaser:0.34.2-7
version: 2
jobs:
+2 -2
View File
@@ -1,7 +1,7 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 120
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 21
daysUntilClose: 14
# Issues with these labels will never be considered stale
exemptLabels:
- Keep
+2 -2
View File
@@ -2,8 +2,8 @@ language: go
sudo: required
dist: precise
go:
- 1.8.5
- 1.9.2
- 1.8.6
- 1.9.3
- tip
os:
- linux
+61 -28
View File
@@ -36,6 +36,23 @@ the GitHub [issue tracker](https://github.com/gohugoio/hugo/issues) to report th
If you're not sure if it's a bug or not, start by asking in the [discussion forum](https://discourse.gohugo.io).
When reporting the issue, please provide the version of Hugo in use (`hugo version`) and your operating system.
## Code Contribution
Hugo has become a fully featured static site generator, so any new functionality must meet these criterias:
* It must be useful to many.
* It must fit natural into _what Hugo does best._
* It must strive not to break existing sites.
* It must close ur update an open [Hugo issue](https://github.com/gohugoio/hugo/issues)
* If it is of some complexity, the contributor is expected to maintain and support the new future (answer questions on the forum, fix any bugs etc.).
So, to avoid doing unneeded work, it is recommended to open up a discussion on the [Hugo Forum](https://discourse.gohugo.io/) to get some acceptance that this is a good idea. Also, if this is a complex feature, create a small design proposal on the [Hugo issue tracker](https://github.com/gohugoio/hugo/issues) before you start coding.
**Bug fixes are, of course, always welcome.**
## Submitting Patches
The Hugo project welcomes all contributors and contributions regardless of skill or experience level.
@@ -88,42 +105,42 @@ new default function more useful for Hugo users.
Fixes #1949
```
### Vendored Dependencies
Hugo uses [Go Dep](https://github.com/golang/dep) to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository.
Therefore, a simple `go get` is not supported since `go get` is not vendor-aware.
You **must use Go Dep** to fetch and manage Hugo's dependencies.
### Fetch the Sources From GitHub
### Fetching the Sources From GitHub
Due to the way Go handles package imports, the best approach for working on a
Hugo fork is to use Git Remotes. Here's a simple walk-through for getting
started:
1. Install Go Dep and get the Hugo source:
1. Get the Hugo source:
```bash
go get -u -v -d github.com/gohugoio/hugo
```
1. Install Mage:
```bash
go get github.com/magefile/mage
```
go get -u -v github.com/golang/dep/cmd/dep
go get -u -v -d github.com/gohugoio/hugo
```
1. Change to the Hugo source directory and fetch the dependencies:
```
```bash
cd $HOME/go/src/github.com/gohugoio/hugo
dep ensure
mage vendor
```
Note that Hugo uses [Go Dep](https://github.com/golang/dep) to vendor dependencies, rather than a a simple `go get`. We don't commit the vendored packages themselves to the Hugo git repository. The call to `mage vendor` takes care of all this for you.
1. Create a new branch for your changes (the branch name is arbitrary):
```
```bash
git checkout -b iss1234
```
1. After making your changes, commit them to your new branch:
```
```bash
git commit -a -v
```
@@ -131,42 +148,58 @@ started:
1. Add your fork as a new remote (the remote name, "fork" in this example, is arbitrary):
```
```bash
git remote add fork git://github.com/USERNAME/hugo.git
```
1. Push the changes to your new remote:
```
```bash
git push --set-upstream fork iss1234
```
1. You're now ready to submit a PR based upon the new branch in your forked repository.
### Build Hugo with Your Changes
### Building Hugo with Your Changes
**Note:** Hugo uses [mage](https://github.com/magefile/mage) to build. To install `mage` run
```bash
go get github.com/magefile/mage
```
`mage -l` lists all available commands with the corresponding description. To build Hugo run
Hugo uses [mage](https://github.com/magefile/mage) to sync vendor dependencies, build Hugo, run the test suite and other things. You must run mage from the Hugo directory.
```bash
cd $HOME/go/src/github.com/gohugoio/hugo
```
To build Hugo:
```bash
mage hugo
# or to install in $HOME/go/bin:
```
To install hugo in `$HOME/go/bin`:
```bash
mage install
```
To run the tests:
```bash
mage hugoRace
mage -v check
```
To list all available commands along with descriptions:
```bash
mage -l
```
### Updating the Hugo Sources
If you want to stay in sync with the Hugo repository, you can easily pull down
the source changes, but you'll need to keep the vendored packages up-to-date as
well.
```
```bash
git pull
mage vendor
```
+1 -1
View File
@@ -4,8 +4,8 @@ RUN apk add --no-cache --virtual git musl-dev
RUN go get github.com/golang/dep/cmd/dep
WORKDIR /go/src/github.com/gohugoio/hugo
RUN dep ensure
ADD . /go/src/github.com/gohugoio/hugo/
RUN dep ensure
RUN go install -ldflags '-s -w'
FROM alpine:3.6
Generated
+40 -28
View File
@@ -28,7 +28,8 @@
"lexers",
"styles"
]
revision = "v0.2.0"
revision = "e0f32fbcb59bc99c521910291b7ba8ecdb17ca34"
version = "v0.2.1"
[[projects]]
branch = "master"
@@ -39,7 +40,8 @@
[[projects]]
name = "github.com/chaseadamsio/goorgeous"
packages = ["."]
revision = "v1.1.0"
revision = "dcf1ef873b8987bf12596fe6951c48347986eb2f"
version = "v1.1.0"
[[projects]]
name = "github.com/cpuguy83/go-md2man"
@@ -62,7 +64,8 @@
[[projects]]
name = "github.com/disintegration/imaging"
packages = ["."]
revision = "v1.2.4"
revision = "dd50a3ee9985ccd313a2f03c398fcaedc96dc707"
version = "v1.2.4"
[[projects]]
name = "github.com/dlclark/regexp2"
@@ -91,8 +94,23 @@
[[projects]]
name = "github.com/fsnotify/fsnotify"
packages = ["."]
revision = "629574ca2a5df945712d3079857300b5e4da0236"
version = "v1.4.2"
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
name = "github.com/gobwas/glob"
packages = [
".",
"compiler",
"match",
"syntax",
"syntax/ast",
"syntax/lexer",
"util/runes",
"util/strings"
]
revision = "bea32b9cd2d6f55753d94a28e959b13f0244797a"
version = "v0.2.2"
[[projects]]
name = "github.com/gorilla/websocket"
@@ -143,12 +161,6 @@
revision = "20d3663d4bc9dd10d75abcde9d92e04b4861c674"
version = "v1.1.0"
[[projects]]
branch = "master"
name = "github.com/kardianos/osext"
packages = ["."]
revision = "ae77be60afb1dcacde03767a8c37337fad28ac14"
[[projects]]
name = "github.com/kyokomi/emoji"
packages = ["."]
@@ -167,14 +179,14 @@
[[projects]]
name = "github.com/magiconair/properties"
packages = ["."]
revision = "be5ece7dd465ab0765a9682137865547526d1dfb"
version = "v1.7.3"
revision = "d419a98cdbed11a922bf76f257b7c4be79b50e73"
version = "v1.7.4"
[[projects]]
branch = "master"
name = "github.com/markbates/inflect"
packages = ["."]
revision = "54ffb37507cd7d2ccd4768855e84f9ff6c4352b6"
revision = "a12c3aec81a6a938bf584a4bac567afed9256586"
[[projects]]
name = "github.com/mattn/go-runewidth"
@@ -192,7 +204,7 @@
branch = "master"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
revision = "06020f85339e21b2478f756a78e295255ffa4d6a"
revision = "b4575eea38cca1123ec2dc90c26529b5c5acfcff"
[[projects]]
name = "github.com/nicksnyder/go-i18n"
@@ -208,7 +220,7 @@
branch = "master"
name = "github.com/olekukonko/tablewriter"
packages = ["."]
revision = "65fec0d89a572b4367094e2058d3ebe667de3b60"
revision = "96aac992fc8b1a4c83841a6c3e7178d20d989625"
[[projects]]
name = "github.com/pelletier/go-toml"
@@ -240,8 +252,8 @@
".",
"mem"
]
revision = "ec3a3111d1e1bdff38a61e09d5a5f5e974905611"
version = "v1.0.1"
revision = "bb8f1927f2a9d3ab41c9340aa034f6b803f4359c"
version = "v1.0.2"
[[projects]]
name = "github.com/spf13/cast"
@@ -256,7 +268,7 @@
".",
"doc"
]
revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b"
revision = "b95ab734e27d33e0d8fbabf71ca990568d4e2020"
[[projects]]
branch = "master"
@@ -268,7 +280,7 @@
branch = "master"
name = "github.com/spf13/jwalterweatherman"
packages = ["."]
revision = "12bd96e66386c1960ab0f74ced1362f66f552f7b"
revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394"
[[projects]]
branch = "master"
@@ -294,8 +306,8 @@
"assert",
"require"
]
revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
version = "v1.1.4"
revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c"
version = "v1.2.0"
[[projects]]
name = "github.com/yosssi/ace"
@@ -315,7 +327,7 @@
"vp8l",
"webp"
]
revision = "f7e31b4ea2e3413ab91b4e7d2dc83e5f8d19a44c"
revision = "12117c17ca67ffa1ce22e9409f3b0b0a93ac08c7"
[[projects]]
branch = "master"
@@ -324,7 +336,7 @@
"context",
"idna"
]
revision = "cd69bc3fc700721b709c3a59e16e24c67b58f6ff"
revision = "5ccada7d0a7ba9aeb5d3aca8d3501b4c2a509fec"
[[projects]]
branch = "master"
@@ -336,7 +348,7 @@
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "8dbc5d05d6edcc104950cc299a1ce6641235bc86"
revision = "810d7000345868fc619eb81f46307107118f4ae1"
[[projects]]
branch = "master"
@@ -358,17 +370,17 @@
"unicode/rangetable",
"width"
]
revision = "c01e4764d870b77f8abe5096ee19ad20d80e8075"
revision = "e19ae1496984b1c655b8044a65c0300a3c878dd3"
[[projects]]
branch = "v2"
name = "gopkg.in/yaml.v2"
packages = ["."]
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
revision = "d670f9405373e636a5a2765eea47fac0c9bc91a4"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "7259b4caf8e75db0b809f06d4897dc870261252e3aecd68ea1348c87a5da9d50"
inputs-digest = "c80ffe69d34005d8d72a87cc491ce1d9c91272e4b7f8fbd22d4fda8973fa8556"
solver-name = "gps-cdcl"
solver-version = 1
+14 -14
View File
@@ -10,7 +10,7 @@
[[constraint]]
name = "github.com/alecthomas/chroma"
revision = "v0.2.0"
version = "^0.2.0"
[[constraint]]
branch = "master"
@@ -18,11 +18,11 @@
[[constraint]]
name = "github.com/chaseadamsio/goorgeous"
revision = "v1.1.0"
version = "^1.1.0"
[[constraint]]
name = "github.com/disintegration/imaging"
revision = "v1.2.4"
version = "~v1.2.4"
[[constraint]]
name = "github.com/magefile/mage"
@@ -38,7 +38,7 @@
[[constraint]]
name = "github.com/fsnotify/fsnotify"
version = "1.4.2"
version = "^1.4.0"
[[constraint]]
name = "github.com/gorilla/websocket"
@@ -52,10 +52,6 @@
name = "github.com/jdkato/prose"
version = "1.1.0"
[[constraint]]
branch = "master"
name = "github.com/kardianos/osext"
[[constraint]]
name = "github.com/kyokomi/emoji"
version = "1.5.0"
@@ -66,7 +62,7 @@
[[constraint]]
name = "github.com/miekg/mmark"
version = "1.3.6"
version = "^1.3.6"
[[constraint]]
branch = "master"
@@ -74,19 +70,19 @@
[[constraint]]
name = "github.com/nicksnyder/go-i18n"
version = "1.10.0"
version = "^1.10.0"
[[constraint]]
name = "github.com/russross/blackfriday"
version = "1.5.0"
version = "^1.5.0"
[[constraint]]
name = "github.com/spf13/afero"
version = "1.0.1"
version = "^1.0.1"
[[constraint]]
name = "github.com/spf13/cast"
version = "1.1.0"
version = "^1.1.0"
[[constraint]]
branch = "master"
@@ -122,7 +118,7 @@
[[constraint]]
name = "github.com/yosssi/ace"
version = "0.0.5"
version = "^0.0.5"
[[constraint]]
branch = "master"
@@ -135,3 +131,7 @@
[[constraint]]
branch = "v2"
name = "gopkg.in/yaml.v2"
[[constraint]]
name = "github.com/gobwas/glob"
version = "0.2.2"
+1 -1
View File
@@ -1,6 +1,6 @@
![Hugo](https://raw.githubusercontent.com/gohugoio/hugoDocs/master/static/img/hugo-logo.png)
A Fast and Flexible Static Site Generator built with love by [spf13](http://spf13.com/) and [friends](https://github.com/gohugoio/hugo/graphs/contributors) in [Go][].
A Fast and Flexible Static Site Generator built with love by [bep](https://github.com/bep), [spf13](http://spf13.com/) and [friends](https://github.com/gohugoio/hugo/graphs/contributors) in [Go][].
[Website](https://gohugo.io) |
[Forum](https://discourse.gohugo.io) |
+1 -1
View File
@@ -12,7 +12,7 @@ install:
- go get github.com/magefile/mage
build_script:
- mage hugoRace
- mage vendor hugoRace
- mage -v check
- hugo -s docs/
- hugo --renderToMemory -s docs/
+1 -1
View File
@@ -9,4 +9,4 @@ GOEXE="${GOEXE-go}"
echo "Running with BenchmarkSiteBuilding/${1}"
"${GOEXE}" test -run="NONE" -bench="BenchmarkSiteBuilding/${1}" -test.benchmem=true ./hugolib -memprofile mem.prof -cpuprofile cpu.prof
"${GOEXE}" test -run="NONE" -bench="BenchmarkSiteBuilding/${1}" -test.benchmem=true ./hugolib -memprofile mem.prof -count 3 -cpuprofile cpu.prof
+5 -1
View File
@@ -48,7 +48,11 @@ func init() {
}
func benchmark(cmd *cobra.Command, args []string) error {
c, err := InitializeConfig(false, nil, benchmarkCmd)
cfgInit := func(c *commandeer) error {
c.Set("renderToMemory", renderToMemory)
return nil
}
c, err := InitializeConfig(false, cfgInit, benchmarkCmd)
if err != nil {
return err
}
+74 -65
View File
@@ -18,8 +18,10 @@ package commands
import (
"fmt"
"io/ioutil"
"os/signal"
"sort"
"sync/atomic"
"syscall"
"golang.org/x/sync/errgroup"
@@ -30,7 +32,6 @@ import (
"path/filepath"
"runtime"
"strings"
"sync"
"time"
src "github.com/gohugoio/hugo/source"
@@ -132,6 +133,7 @@ Complete documentation is available at http://gohugo.io/.`,
if buildWatch {
c.Set("disableLiveReload", true)
}
c.Set("renderToMemory", renderToMemory)
return nil
}
@@ -206,7 +208,6 @@ func AddCommands() {
HugoCmd.AddCommand(convertCmd)
HugoCmd.AddCommand(newCmd)
HugoCmd.AddCommand(listCmd)
HugoCmd.AddCommand(undraftCmd)
HugoCmd.AddCommand(importCmd)
HugoCmd.AddCommand(genCmd)
@@ -240,9 +241,6 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
cmd.Flags().BoolP("buildDrafts", "D", false, "include content marked as draft")
cmd.Flags().BoolP("buildFuture", "F", false, "include content with publishdate in the future")
cmd.Flags().BoolP("buildExpired", "E", false, "include expired content")
cmd.Flags().Bool("disable404", false, "do not render 404 page")
cmd.Flags().Bool("disableRSS", false, "do not build RSS files")
cmd.Flags().Bool("disableSitemap", false, "do not build Sitemap file")
cmd.Flags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
cmd.Flags().StringVarP(&contentDir, "contentDir", "c", "", "filesystem path to content directory")
cmd.Flags().StringVarP(&layoutDir, "layoutDir", "l", "", "filesystem path to layout directory")
@@ -251,8 +249,8 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&destination, "destination", "d", "", "filesystem path to write files to")
cmd.Flags().StringVarP(&theme, "theme", "t", "", "theme to use (located in /themes/THEMENAME/)")
cmd.Flags().StringVarP(&themesDir, "themesDir", "", "", "filesystem path to themes directory")
cmd.Flags().Bool("uglyURLs", false, "if true, use /filename.html instead of /filename/")
cmd.Flags().Bool("canonifyURLs", false, "if true, all relative URLs will be canonicalized using baseURL")
cmd.Flags().Bool("uglyURLs", false, "(deprecated) if true, use /filename.html instead of /filename/")
cmd.Flags().Bool("canonifyURLs", false, "(deprecated) if true, all relative URLs will be canonicalized using baseURL")
cmd.Flags().StringVarP(&baseURL, "baseURL", "b", "", "hostname (and path) to the root, e.g. http://spf13.com/")
cmd.Flags().Bool("enableGitInfo", false, "add Git revision, date and author info to the pages")
cmd.Flags().BoolVar(&gc, "gc", false, "enable to run some cleanup tasks (remove unused cache files) after the build")
@@ -260,8 +258,8 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&nitro.AnalysisOn, "stepAnalysis", false, "display memory and timing of different steps of the program")
cmd.Flags().Bool("templateMetrics", false, "display metrics about template executions")
cmd.Flags().Bool("templateMetricsHints", false, "calculate some improvement hints when combined with --templateMetrics")
cmd.Flags().Bool("pluralizeListTitles", true, "pluralize titles in lists using inflect")
cmd.Flags().Bool("preserveTaxonomyNames", false, `preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")`)
cmd.Flags().Bool("pluralizeListTitles", true, "(deprecated) pluralize titles in lists using inflect")
cmd.Flags().Bool("preserveTaxonomyNames", false, `(deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")`)
cmd.Flags().BoolP("forceSyncStatic", "", false, "copy all files when static is changed.")
cmd.Flags().BoolP("noTimes", "", false, "don't sync modification time of files")
cmd.Flags().BoolP("noChmod", "", false, "don't sync permission mode of files")
@@ -489,9 +487,6 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
"buildExpired",
"uglyURLs",
"canonifyURLs",
"disable404",
"disableRSS",
"disableSitemap",
"enableRobotsTXT",
"enableGitInfo",
"pluralizeListTitles",
@@ -504,19 +499,6 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
"templateMetricsHints",
}
// Remove these in Hugo 0.33.
if cmd.Flags().Changed("disable404") {
helpers.Deprecated("command line", "--disable404", "Use --disableKinds=404", true)
}
if cmd.Flags().Changed("disableRSS") {
helpers.Deprecated("command line", "--disableRSS", "Use --disableKinds=RSS", true)
}
if cmd.Flags().Changed("disableSitemap") {
helpers.Deprecated("command line", "--disableSitemap", "Use --disableKinds=sitemap", true)
}
for _, key := range persFlagKeys {
c.setValueFromFlag(cmd.PersistentFlags(), key)
}
@@ -526,8 +508,21 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
}
var deprecatedFlags = map[string]bool{
strings.ToLower("uglyURLs"): true,
strings.ToLower("pluralizeListTitles"): true,
strings.ToLower("preserveTaxonomyNames"): true,
strings.ToLower("canonifyURLs"): true,
}
func (c *commandeer) setValueFromFlag(flags *flag.FlagSet, key string) {
if flags.Changed(key) {
if _, deprecated := deprecatedFlags[strings.ToLower(key)]; deprecated {
msg := fmt.Sprintf(`Set "%s = true" in your config.toml.
If you need to set this configuration value from the command line, set it via an OS environment variable: "HUGO_%s=true hugo"`, key, strings.ToUpper(key))
// Remove in Hugo 0.37
helpers.Deprecated("hugo", "--"+key+" flag", msg, false)
}
f := flags.Lookup(key)
c.Set(key, f.Value.String())
}
@@ -547,7 +542,7 @@ func (c *commandeer) watchConfig() {
})
}
func (c *commandeer) fullBuild(watches ...bool) error {
func (c *commandeer) fullBuild() error {
var (
g errgroup.Group
langCount map[string]uint64
@@ -560,25 +555,36 @@ func (c *commandeer) fullBuild(watches ...bool) error {
}()
}
g.Go(func() error {
copyStaticFunc := func() error {
cnt, err := c.copyStatic()
if err != nil {
return fmt.Errorf("Error copying static files: %s", err)
}
langCount = cnt
return nil
})
g.Go(func() error {
}
buildSitesFunc := func() error {
if err := c.buildSites(); err != nil {
return fmt.Errorf("Error building site: %s", err)
}
return nil
})
if err := g.Wait(); err != nil {
return err
}
// Do not copy static files and build sites in parallel if cleanDestinationDir is enabled.
// This flag deletes all static resources in /public folder that are missing in /static,
// and it does so at the end of copyStatic() call.
if c.Cfg.GetBool("cleanDestinationDir") {
if err := copyStaticFunc(); err != nil {
return err
}
if err := buildSitesFunc(); err != nil {
return err
}
} else {
g.Go(copyStaticFunc)
g.Go(buildSitesFunc)
if err := g.Wait(); err != nil {
return err
}
}
for _, s := range Hugo.Sites {
@@ -600,10 +606,10 @@ func (c *commandeer) fullBuild(watches ...bool) error {
}
func (c *commandeer) build(watches ...bool) error {
func (c *commandeer) build() error {
defer c.timeTrack(time.Now(), "Total")
if err := c.fullBuild(watches...); err != nil {
if err := c.fullBuild(); err != nil {
return err
}
@@ -621,7 +627,31 @@ func (c *commandeer) build(watches ...bool) error {
}
c.Logger.FEEDBACK.Println("Watching for changes in", c.PathSpec().AbsPathify(c.Cfg.GetString("contentDir")))
c.Logger.FEEDBACK.Println("Press Ctrl+C to stop")
utils.CheckErr(c.Logger, c.newWatcher(false, watchDirs...))
watcher, err := c.newWatcher(watchDirs...)
utils.CheckErr(c.Logger, err)
defer watcher.Close()
var sigs = make(chan os.Signal)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
<-sigs
}
return nil
}
func (c *commandeer) serverBuild() error {
defer c.timeTrack(time.Now(), "Total")
if err := c.fullBuild(); err != nil {
return err
}
// TODO(bep) Feedback?
if !quiet {
fmt.Println()
Hugo.PrintProcessingStats(os.Stdout)
fmt.Println()
}
return nil
@@ -891,6 +921,7 @@ func (c *commandeer) getDirList() ([]string, error) {
}
func (c *commandeer) recreateAndBuildSites(watching bool) (err error) {
defer c.timeTrack(time.Now(), "Total")
if err := c.initSites(); err != nil {
return err
}
@@ -956,29 +987,22 @@ func (c *commandeer) rebuildSites(events []fsnotify.Event) error {
}
// newWatcher creates a new watcher to watch filesystem events.
// if serve is set it will also start one or more HTTP servers to serve those
// files.
func (c *commandeer) newWatcher(serve bool, dirList ...string) error {
func (c *commandeer) newWatcher(dirList ...string) (*watcher.Batcher, error) {
if runtime.GOOS == "darwin" {
tweakLimit()
}
staticSyncer, err := newStaticSyncer(c)
if err != nil {
return err
return nil, err
}
watcher, err := watcher.New(1 * time.Second)
var wg sync.WaitGroup
if err != nil {
return err
return nil, err
}
defer watcher.Close()
wg.Add(1)
for _, d := range dirList {
if d != "" {
_ = watcher.Add(d)
@@ -1132,14 +1156,6 @@ func (c *commandeer) newWatcher(serve bool, dirList ...string) error {
doLiveReload := !buildWatch && !c.Cfg.GetBool("disableLiveReload")
onePageName := pickOneWriteOrCreatePath(dynamicEvents)
if onePageName != "" && doLiveReload && !c.Cfg.GetBool("disableFastRender") {
p := Hugo.GetContentPage(onePageName)
if p != nil {
c.visitedURLs.Add(p.RelPermalink())
}
}
c.Logger.FEEDBACK.Println("\nChange detected, rebuilding site")
const layout = "2006-01-02 15:04:05.000 -0700"
c.Logger.FEEDBACK.Println(time.Now().Format(layout))
@@ -1176,12 +1192,7 @@ func (c *commandeer) newWatcher(serve bool, dirList ...string) error {
}
}()
if serve {
go c.serve()
}
wg.Wait()
return nil
return watcher, nil
}
func pickOneWriteOrCreatePath(events []fsnotify.Event) string {
@@ -1224,9 +1235,7 @@ func (c *commandeer) isThemeVsHugoVersionMismatch() (mismatch bool, requiredMinV
return
}
config := tomlMeta.(map[string]interface{})
if minVersion, ok := config["min_version"]; ok {
if minVersion, ok := tomlMeta["min_version"]; ok {
return helpers.CompareVersion(minVersion) > 0, fmt.Sprint(minVersion)
}
+2 -10
View File
@@ -144,11 +144,6 @@ func importFromJekyll(cmd *cobra.Command, args []string) error {
"$ git clone https://github.com/spf13/herring-cove.git " + args[1] + "/themes/herring-cove")
jww.FEEDBACK.Println("$ cd " + args[1] + "\n$ hugo server --theme=herring-cove")
jww.FEEDBACK.Println("Congratulations!", fileCount, "post(s) imported!")
jww.FEEDBACK.Println("Now, start Hugo by yourself:\n" +
"$ git clone https://github.com/spf13/herring-cove.git " + args[1] + "/themes/herring-cove")
jww.FEEDBACK.Println("$ cd " + args[1] + "\n$ hugo server --theme=herring-cove")
return nil
}
@@ -255,7 +250,7 @@ func loadJekyllConfig(fs afero.Fs, jekyllRoot string) map[string]interface{} {
return nil
}
return c.(map[string]interface{})
return c
}
func createConfigFromJekyll(fs afero.Fs, inpath string, kind string, jekyllConfig map[string]interface{}) (err error) {
@@ -478,8 +473,6 @@ func convertJekyllPost(s *hugolib.Site, path, relPath, targetDir string, draft b
}
func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, draft bool) (interface{}, error) {
url := postDate.Format("/2006/01/02/") + postName + "/"
metadata, err := cast.ToStringMapE(m)
if err != nil {
return nil, err
@@ -497,7 +490,7 @@ func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, d
delete(metadata, key)
case "permalink":
if str, ok := value.(string); ok {
url = str
metadata["url"] = str
}
delete(metadata, key)
case "category":
@@ -526,7 +519,6 @@ func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, d
}
metadata["url"] = url
metadata["date"] = postDate.Format(time.RFC3339)
return metadata, nil
+5 -5
View File
@@ -51,9 +51,9 @@ func TestConvertJekyllMetadata(t *testing.T) {
expect string
}{
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z","url":"/2015/10/01/testPost/"}`},
`{"date":"2015-10-01T00:00:00Z"}`},
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), true,
`{"date":"2015-10-01T00:00:00Z","draft":true,"url":"/2015/10/01/testPost/"}`},
`{"date":"2015-10-01T00:00:00Z","draft":true}`},
{map[interface{}]interface{}{"Permalink": "/permalink.html", "layout": "post"},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
@@ -62,13 +62,13 @@ func TestConvertJekyllMetadata(t *testing.T) {
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
{map[interface{}]interface{}{"category": nil, "permalink": 123},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z","url":"/2015/10/01/testPost/"}`},
`{"date":"2015-10-01T00:00:00Z"}`},
{map[interface{}]interface{}{"Excerpt_Separator": "sep"},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep","url":"/2015/10/01/testPost/"}`},
`{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep"}`},
{map[interface{}]interface{}{"category": "book", "layout": "post", "Others": "Goods", "Date": "2015-10-01 12:13:11"},
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
`{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z","url":"/2015/10/01/testPost/"}`},
`{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z"}`},
}
for _, data := range testDataList {
+1 -1
View File
@@ -344,7 +344,7 @@ description = ""
homepage = "http://example.com/"
tags = []
features = []
min_version = "0.32"
min_version = "0.35"
[author]
name = ""
+32 -14
View File
@@ -19,10 +19,12 @@ import (
"net/http"
"net/url"
"os"
"os/signal"
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
"time"
"github.com/gohugoio/hugo/livereload"
@@ -171,20 +173,25 @@ func server(cmd *cobra.Command, args []string) error {
c.Set("liveReloadPort", serverPorts[0])
}
if c.languages.IsMultihost() {
for i, language := range c.languages {
baseURL, err := fixURL(language, baseURL, serverPorts[i])
if err != nil {
return err
}
language.Set("baseURL", baseURL)
isMultiHost := c.languages.IsMultihost()
for i, language := range c.languages {
var serverPort int
if isMultiHost {
serverPort = serverPorts[i]
} else {
serverPort = serverPorts[0]
}
} else {
baseURL, err := fixURL(c.Cfg, baseURL, serverPorts[0])
baseURL, err := fixURL(language, baseURL, serverPort)
if err != nil {
return err
}
c.Set("baseURL", baseURL)
if isMultiHost {
language.Set("baseURL", baseURL)
}
if i == 0 {
c.Set("baseURL", baseURL)
}
}
return nil
@@ -200,7 +207,7 @@ func server(cmd *cobra.Command, args []string) error {
return err
}
if err := c.build(serverWatch); err != nil {
if err := c.serverBuild(); err != nil {
return err
}
@@ -229,14 +236,18 @@ func server(cmd *cobra.Command, args []string) error {
rootWatchDirs := strings.Join(helpers.UniqueStrings(helpers.ExtractRootPaths(relWatchDirs)), ",")
jww.FEEDBACK.Printf("Watching for changes in %s%s{%s}\n", baseWatchDir, helpers.FilePathSeparator, rootWatchDirs)
err = c.newWatcher(true, watchDirs...)
watcher, err := c.newWatcher(watchDirs...)
if err != nil {
return err
}
defer watcher.Close()
}
return nil
return c.serve()
}
type fileServer struct {
@@ -313,7 +324,7 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
return mu, u.String(), endpoint, nil
}
func (c *commandeer) serve() {
func (c *commandeer) serve() error {
isMultiHost := Hugo.IsMultihost()
@@ -345,6 +356,9 @@ func (c *commandeer) serve() {
livereload.Initialize()
}
var sigs = make(chan os.Signal)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
for i, _ := range baseURLs {
mu, serverURL, endpoint, err := srv.createEndpoint(i)
@@ -363,6 +377,10 @@ func (c *commandeer) serve() {
}
jww.FEEDBACK.Println("Press Ctrl+C to stop")
<-sigs
return nil
}
// fixURL massages the baseURL into a form needed for serving
-157
View File
@@ -1,157 +0,0 @@
// Copyright 2015 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package commands
import (
"bytes"
"errors"
"os"
"time"
"github.com/gohugoio/hugo/parser"
"github.com/spf13/cobra"
)
var undraftCmd = &cobra.Command{
Use: "undraft path/to/content",
Short: "Undraft resets the content's draft status",
Long: `Undraft resets the content's draft status
and updates the date to the current date and time.
If the content's draft status is 'False', nothing is done.`,
RunE: Undraft,
}
// Undraft publishes the specified content by setting its draft status
// to false and setting its publish date to now. If the specified content is
// not a draft, it will log an error.
func Undraft(cmd *cobra.Command, args []string) error {
c, err := InitializeConfig(false, nil)
if err != nil {
return err
}
if len(args) < 1 {
return newUserError("a piece of content needs to be specified")
}
cfg := c.DepsCfg
location := args[0]
// open the file
f, err := cfg.Fs.Source.Open(location)
if err != nil {
return err
}
// get the page from file
p, err := parser.ReadFrom(f)
f.Close()
if err != nil {
return err
}
w, err := undraftContent(p)
if err != nil {
return newSystemErrorF("an error occurred while undrafting %q: %s", location, err)
}
f, err = cfg.Fs.Source.OpenFile(location, os.O_WRONLY|os.O_TRUNC, 0644)
if err != nil {
return newSystemErrorF("%q not be undrafted due to error opening file to save changes: %q\n", location, err)
}
defer f.Close()
_, err = w.WriteTo(f)
if err != nil {
return newSystemErrorF("%q not be undrafted due to save error: %q\n", location, err)
}
return nil
}
// undraftContent: if the content is a draft, change its draft status to
// 'false' and set the date to time.Now(). If the draft status is already
// 'false', don't do anything.
func undraftContent(p parser.Page) (bytes.Buffer, error) {
var buff bytes.Buffer
// get the metadata; easiest way to see if it's a draft
meta, err := p.Metadata()
if err != nil {
return buff, err
}
// since the metadata was obtainable, we can also get the key/value separator for
// Front Matter
fm := p.FrontMatter()
if fm == nil {
return buff, errors.New("Front Matter was found, nothing was finalized")
}
var isDraft, gotDate bool
var date string
L:
for k, v := range meta.(map[string]interface{}) {
switch k {
case "draft":
if !v.(bool) {
return buff, errors.New("not a Draft: nothing was done")
}
isDraft = true
if gotDate {
break L
}
case "date":
date = v.(string) // capture the value to make replacement easier
gotDate = true
if isDraft {
break L
}
}
}
// if draft wasn't found in FrontMatter, it isn't a draft.
if !isDraft {
return buff, errors.New("not a Draft: nothing was done")
}
// get the front matter as bytes and split it into lines
var lineEnding []byte
fmLines := bytes.Split(fm, []byte("\n"))
if len(fmLines) == 1 { // if the result is only 1 element, try to split on dos line endings
fmLines = bytes.Split(fm, []byte("\r\n"))
if len(fmLines) == 1 {
return buff, errors.New("unable to split FrontMatter into lines")
}
lineEnding = append(lineEnding, []byte("\r\n")...)
} else {
lineEnding = append(lineEnding, []byte("\n")...)
}
// Write the front matter lines to the buffer, replacing as necessary
for _, v := range fmLines {
pos := bytes.Index(v, []byte("draft"))
if pos != -1 {
continue
}
pos = bytes.Index(v, []byte("date"))
if pos != -1 { // if date field wasn't found, add it
v = bytes.Replace(v, []byte(date), []byte(time.Now().Format(time.RFC3339)), 1)
}
buff.Write(v)
buff.Write(lineEnding)
}
// append the actual content
buff.Write(p.Content())
return buff, nil
}
-87
View File
@@ -1,87 +0,0 @@
// Copyright 2015 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package commands
// TODO Support Mac Encoding (\r)
import (
"bytes"
"strings"
"testing"
"time"
"github.com/gohugoio/hugo/parser"
)
var (
jsonFM = "{\n \"date\": \"12-04-06\",\n \"title\": \"test json\"\n}"
jsonDraftFM = "{\n \"draft\": true,\n \"date\": \"12-04-06\",\n \"title\":\"test json\"\n}"
tomlFM = "+++\n date= \"12-04-06\"\n title= \"test toml\"\n+++"
tomlDraftFM = "+++\n draft= true\n date= \"12-04-06\"\n title=\"test toml\"\n+++"
yamlFM = "---\n date: \"12-04-06\"\n title: \"test yaml\"\n---"
yamlDraftFM = "---\n draft: true\n date: \"12-04-06\"\n title: \"test yaml\"\n---"
yamlYesDraftFM = "---\n draft: yes\n date: \"12-04-06\"\n title: \"test yaml\"\n---"
)
func TestUndraftContent(t *testing.T) {
tests := []struct {
fm string
expectedErr string
}{
{jsonFM, "not a Draft: nothing was done"},
{jsonDraftFM, ""},
{tomlFM, "not a Draft: nothing was done"},
{tomlDraftFM, ""},
{yamlFM, "not a Draft: nothing was done"},
{yamlDraftFM, ""},
{yamlYesDraftFM, ""},
}
for i, test := range tests {
r := bytes.NewReader([]byte(test.fm))
p, _ := parser.ReadFrom(r)
res, err := undraftContent(p)
if test.expectedErr != "" {
if err == nil {
t.Errorf("[%d] Expected error, got none", i)
continue
}
if err.Error() != test.expectedErr {
t.Errorf("[%d] Expected %q, got %q", i, test.expectedErr, err)
continue
}
} else {
r = bytes.NewReader(res.Bytes())
p, _ = parser.ReadFrom(r)
meta, err := p.Metadata()
if err != nil {
t.Errorf("[%d] unexpected error %q", i, err)
continue
}
for k, v := range meta.(map[string]interface{}) {
if k == "draft" {
if v.(bool) {
t.Errorf("[%d] Expected %q to be \"false\", got \"true\"", i, k)
continue
}
}
if k == "date" {
if !strings.HasPrefix(v.(string), time.Now().Format("2006-01-02")) {
t.Errorf("[%d] Expected %v to start with %v", i, v.(string), time.Now().Format("2006-01-02"))
}
}
}
}
}
}
-38
View File
@@ -14,15 +14,11 @@
package commands
import (
"os"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugolib"
"github.com/kardianos/osext"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
)
@@ -38,43 +34,9 @@ var versionCmd = &cobra.Command{
}
func printHugoVersion() {
if hugolib.BuildDate == "" {
setBuildDate() // set the build date from executable's mdate
} else {
formatBuildDate() // format the compile time
}
if hugolib.CommitHash == "" {
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s %s/%s BuildDate: %s\n", helpers.CurrentHugoVersion, runtime.GOOS, runtime.GOARCH, hugolib.BuildDate)
} else {
jww.FEEDBACK.Printf("Hugo Static Site Generator v%s-%s %s/%s BuildDate: %s\n", helpers.CurrentHugoVersion, strings.ToUpper(hugolib.CommitHash), runtime.GOOS, runtime.GOARCH, hugolib.BuildDate)
}
}
// setBuildDate checks the ModTime of the Hugo executable and returns it as a
// formatted string. This assumes that the executable name is Hugo, if it does
// not exist, an empty string will be returned. This is only called if the
// hugolib.BuildDate wasn't set during compile time.
//
// osext is used for cross-platform.
func setBuildDate() {
fname, _ := osext.Executable()
dir, err := filepath.Abs(filepath.Dir(fname))
if err != nil {
jww.ERROR.Println(err)
return
}
fi, err := os.Lstat(filepath.Join(dir, filepath.Base(fname)))
if err != nil {
jww.ERROR.Println(err)
return
}
t := fi.ModTime()
hugolib.BuildDate = t.Format(time.RFC3339)
}
// formatBuildDate formats the hugolib.BuildDate according to the value in
// .Params.DateFormat, if it's set.
func formatBuildDate() {
t, _ := time.Parse("2006-01-02T15:04:05-0700", hugolib.BuildDate)
hugolib.BuildDate = t.Format(time.RFC3339)
}
+1
View File
@@ -20,6 +20,7 @@ type Provider interface {
GetBool(key string) bool
GetStringMap(key string) map[string]interface{}
GetStringMapString(key string) map[string]string
GetStringSlice(key string) []string
Get(key string) interface{}
Set(key string, value interface{})
IsSet(key string) bool
+17 -2
View File
@@ -16,6 +16,7 @@ package create
import (
"bytes"
"fmt"
"path/filepath"
"strings"
"time"
@@ -43,6 +44,12 @@ type ArchetypeFileData struct {
// on the presence of language code in the filename.
Site *hugolib.Site
// Name will in most cases be the same as TranslationBaseName, e.g. "my-post".
// But if that value is "index" (bundles), the Name is instead the owning folder.
// This is the value you in most cases would want to use to construct the title in your
// archetype template.
Name string
// The target content file. Note that the .Content will be empty, as that
// has not been created yet.
source.File
@@ -51,7 +58,7 @@ type ArchetypeFileData struct {
const (
// ArchetypeTemplateTemplate is used as initial template when adding an archetype template.
ArchetypeTemplateTemplate = `---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---
@@ -82,11 +89,19 @@ func executeArcheTypeAsTemplate(s *hugolib.Site, kind, targetPath, archetypeFile
)
sp := source.NewSourceSpec(s.Deps.Cfg, s.Deps.Fs)
f := sp.NewFileInfo("", targetPath, nil)
f := sp.NewFileInfo("", targetPath, false, nil)
name := f.TranslationBaseName()
if name == "index" || name == "_index" {
// Page bundles; the directory name will hopefully have a better name.
dir := strings.TrimSuffix(f.Dir(), helpers.FilePathSeparator)
_, name = filepath.Split(dir)
}
data := ArchetypeFileData{
Type: kind,
Date: time.Now().Format(time.RFC3339),
Name: name,
File: f,
Site: s,
}
+7 -5
View File
@@ -1,11 +1,13 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
linktitle: ""
description: ""
godocref: ""
publishdate: ""
lastmod: ""
categories: []
keywords: []
tags: []
weight: 00
slug: ""
aliases: []
toc: false
draft: true
---
---
+3 -2
View File
@@ -71,7 +71,7 @@ twitter = "GoHugoIO"
[params]
description = "The worlds fastest framework for building websites"
## Used for views in rendered HTML (i.e., rather than using the .Hugo variable)
release = "0.32"
release = "0.35"
## Setting this to true will add a "noindex" to *EVERY* page on the site
removefromexternalsearch = false
## Gh repo for site footer (include trailing slash)
@@ -98,7 +98,8 @@ twitter = "GoHugoIO"
## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
[blackfriday]
plainIDAnchors = true
hrefTargetBlank = true
# See https://github.com/gohugoio/hugo/issues/2424
hrefTargetBlank = false
angledQuotes = false
latexDashes = true
-2
View File
@@ -55,7 +55,6 @@ toc: true
* Support for [Go][], [Amber], and [Ace][] HTML templates
* [Syntax highlighting][] powered by [Pygments][]
See what's coming next in the [Hugo roadmap][].
[Ace]: /templates/alternatives/
[aliases]: /content-management/urls/#aliases
@@ -71,7 +70,6 @@ See what's coming next in the [Hugo roadmap][].
[Google Analytics]: https://google-analytics.com/
[homepage]: /templates/homepage/
[hostanywhere]: /hosting-and-deployment/
[Hugo roadmap]: /about/roadmap
[install]: /getting-started/installing/
[LiveReload]: /getting-started/usage/
[organization for your projects]: /getting-started/directory-structure/
@@ -12,6 +12,8 @@ sections_weight: 10
draft: false
aliases: []
toc: true
images:
- images/blog/sunset.jpg
---
@@ -119,6 +121,35 @@ Image operations in Hugo currently **do not preserve EXIF data** as this is not
{{% /note %}}
### Image Processing Examples
_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_
{{< imgproc sunset Resize "300x" />}}
{{< imgproc sunset Fill "90x120 left" />}}
{{< imgproc sunset Fill "90x120 right" />}}
{{< imgproc sunset Fit "90x90" />}}
{{< imgproc sunset Resize "300x q10" />}}
This is the shortcode used in the examples above:
{{< code file="layouts/shortcodes/imgproc.html" >}}
{{< readfile file="layouts/shortcodes/imgproc.html" >}}
{{< /code >}}
And it is used like this:
```html
{{</* imgproc sunset Resize "300x" */>}}
```
### Image Processing Options
In addition to the dimensions (e.g. `200x100`) where either height or width can be omitted, Hugo supports a set of additional image options:
Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

+2 -2
View File
@@ -19,7 +19,7 @@ toc: true
Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator][]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for website authors.
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [GitLab Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
We think of Hugo as the ideal website creation tool with nearly instant build times, able to rebuild whenever a change is made.
@@ -50,7 +50,7 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat
[DreamHost]: http://www.dreamhost.com/
[Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting"
[GitHub Pages]: https://pages.github.com/
[GitLab]: https://about.gitlab.com
[GitLab Pages]: https://about.gitlab.com/features/pages/
[Go language]: https://golang.org/
[GoDaddy]: https://www.godaddy.com/ "Godaddy.com Hosting"
[Google Cloud Storage]: http://cloud.google.com/storage/
+7 -11
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo"
slug: hugo
url: /commands/hugo/
@@ -10,7 +10,6 @@ hugo builds your site
### Synopsis
hugo is the main command, used to build your Hugo site.
Hugo is a Fast and Flexible Static Site Generator
@@ -30,16 +29,13 @@ hugo [flags]
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
--config string config file (default is path/config.yaml|json|toml)
-c, --contentDir string filesystem path to content directory
--debug debug output
-d, --destination string filesystem path to write files to
--disable404 do not render 404 page
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
--disableRSS do not build RSS files
--disableSitemap do not build Sitemap file
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
@@ -51,8 +47,8 @@ hugo [flags]
--logFile string log File path (if set, logging enabled automatically)
--noChmod don't sync permission mode of files
--noTimes don't sync modification time of files
--pluralizeListTitles pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--quiet build in quiet mode
--renderToMemory render to memory (only useful for benchmark testing)
-s, --source string filesystem path to read files relative from
@@ -61,13 +57,14 @@ hugo [flags]
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs if true, use /filename.html instead of /filename/
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
-v, --verbose verbose output
--verboseLog verbose logging
-w, --watch watch filesystem for changes and recreate as needed
```
### SEE ALSO
* [hugo benchmark](/commands/hugo_benchmark/) - Benchmark Hugo by building a site a number of times.
* [hugo check](/commands/hugo_check/) - Contains some verification checks
* [hugo config](/commands/hugo_config/) - Print the site configuration
@@ -78,7 +75,6 @@ hugo [flags]
* [hugo list](/commands/hugo_list/) - Listing out various types of content
* [hugo new](/commands/hugo_new/) - Create new content for your site
* [hugo server](/commands/hugo_server/) - A high performance webserver
* [hugo undraft](/commands/hugo_undraft/) - Undraft resets the content's draft status
* [hugo version](/commands/hugo_version/) - Print the version number of Hugo
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+7 -10
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo benchmark"
slug: hugo_benchmark
url: /commands/hugo_benchmark/
@@ -10,7 +10,6 @@ Benchmark Hugo by building a site a number of times.
### Synopsis
Hugo can build a site many times over and analyze the running process
creating a benchmark.
@@ -26,16 +25,13 @@ hugo benchmark [flags]
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-n, --count int number of times to build the site (default 13)
--cpuprofile string path/filename for the CPU profile file
-d, --destination string filesystem path to write files to
--disable404 do not render 404 page
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
--disableRSS do not build RSS files
--disableSitemap do not build Sitemap file
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
@@ -46,8 +42,8 @@ hugo benchmark [flags]
--memprofile string path/filename for the memory profile file
--noChmod don't sync permission mode of files
--noTimes don't sync modification time of files
--pluralizeListTitles pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--renderToMemory render to memory (only useful for benchmark testing)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
@@ -55,7 +51,7 @@ hugo benchmark [flags]
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs if true, use /filename.html instead of /filename/
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
```
### Options inherited from parent commands
@@ -71,6 +67,7 @@ hugo benchmark [flags]
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo check"
slug: hugo_check
url: /commands/hugo_check/
@@ -10,7 +10,6 @@ Contains some verification checks
### Synopsis
Contains some verification checks
### Options
@@ -32,7 +31,8 @@ Contains some verification checks
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo check ulimit](/commands/hugo_check_ulimit/) - Check system ulimit settings
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo check ulimit"
slug: hugo_check_ulimit
url: /commands/hugo_check_ulimit/
@@ -10,7 +10,6 @@ Check system ulimit settings
### Synopsis
Hugo will inspect the current ulimit settings on the system.
This is primarily to ensure that Hugo can watch enough files on some OSs
@@ -37,6 +36,7 @@ hugo check ulimit [flags]
```
### SEE ALSO
* [hugo check](/commands/hugo_check/) - Contains some verification checks
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo config"
slug: hugo_config
url: /commands/hugo_config/
@@ -10,7 +10,6 @@ Print the site configuration
### Synopsis
Print the site configuration, both default and custom settings.
```
@@ -36,6 +35,7 @@ hugo config [flags]
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo convert"
slug: hugo_convert
url: /commands/hugo_convert/
@@ -10,7 +10,6 @@ Convert your content to different formats
### Synopsis
Convert your content (e.g. front matter) to different formats.
See convert's subcommands toJSON, toTOML and toYAML for more information.
@@ -37,9 +36,10 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo convert toJSON](/commands/hugo_convert_tojson/) - Convert front matter to JSON
* [hugo convert toTOML](/commands/hugo_convert_totoml/) - Convert front matter to TOML
* [hugo convert toYAML](/commands/hugo_convert_toyaml/) - Convert front matter to YAML
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo convert toJSON"
slug: hugo_convert_toJSON
url: /commands/hugo_convert_tojson/
@@ -10,7 +10,6 @@ Convert front matter to JSON
### Synopsis
toJSON converts all front matter in the content directory
to use JSON for the front matter.
@@ -40,6 +39,7 @@ hugo convert toJSON [flags]
```
### SEE ALSO
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo convert toTOML"
slug: hugo_convert_toTOML
url: /commands/hugo_convert_totoml/
@@ -10,7 +10,6 @@ Convert front matter to TOML
### Synopsis
toTOML converts all front matter in the content directory
to use TOML for the front matter.
@@ -40,6 +39,7 @@ hugo convert toTOML [flags]
```
### SEE ALSO
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo convert toYAML"
slug: hugo_convert_toYAML
url: /commands/hugo_convert_toyaml/
@@ -10,7 +10,6 @@ Convert front matter to YAML
### Synopsis
toYAML converts all front matter in the content directory
to use YAML for the front matter.
@@ -40,6 +39,7 @@ hugo convert toYAML [flags]
```
### SEE ALSO
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo env"
slug: hugo_env
url: /commands/hugo_env/
@@ -10,7 +10,6 @@ Print Hugo version and environment info
### Synopsis
Print Hugo version and environment info. This is useful in Hugo bug reports.
```
@@ -36,6 +35,7 @@ hugo env [flags]
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo gen"
slug: hugo_gen
url: /commands/hugo_gen/
@@ -10,7 +10,6 @@ A collection of several useful generators.
### Synopsis
A collection of several useful generators.
### Options
@@ -32,10 +31,11 @@ A collection of several useful generators.
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo gen autocomplete](/commands/hugo_gen_autocomplete/) - Generate shell autocompletion script for Hugo
* [hugo gen chromastyles](/commands/hugo_gen_chromastyles/) - Generate CSS stylesheet for the Chroma code highlighter
* [hugo gen doc](/commands/hugo_gen_doc/) - Generate Markdown documentation for the Hugo CLI.
* [hugo gen man](/commands/hugo_gen_man/) - Generate man pages for the Hugo CLI
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo gen autocomplete"
slug: hugo_gen_autocomplete
url: /commands/hugo_gen_autocomplete/
@@ -10,7 +10,6 @@ Generate shell autocompletion script for Hugo
### Synopsis
Generates a shell autocompletion script for Hugo.
NOTE: The current version supports Bash only.
@@ -54,6 +53,7 @@ hugo gen autocomplete [flags]
```
### SEE ALSO
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo gen chromastyles"
slug: hugo_gen_chromastyles
url: /commands/hugo_gen_chromastyles/
@@ -10,7 +10,6 @@ Generate CSS stylesheet for the Chroma code highlighter
### Synopsis
Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if pygmentsUseClasses is enabled in config.
See https://help.farbox.com/pygments.html for preview of available styles
@@ -41,6 +40,7 @@ hugo gen chromastyles [flags]
```
### SEE ALSO
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo gen doc"
slug: hugo_gen_doc
url: /commands/hugo_gen_doc/
@@ -10,7 +10,6 @@ Generate Markdown documentation for the Hugo CLI.
### Synopsis
Generate Markdown documentation for the Hugo CLI.
This command is, mostly, used to create up-to-date documentation
@@ -43,6 +42,7 @@ hugo gen doc [flags]
```
### SEE ALSO
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo gen man"
slug: hugo_gen_man
url: /commands/hugo_gen_man/
@@ -10,7 +10,6 @@ Generate man pages for the Hugo CLI
### Synopsis
This command automatically generates up-to-date man pages of Hugo's
command-line interface. By default, it creates the man page files
in the "man" directory under the current directory.
@@ -39,6 +38,7 @@ hugo gen man [flags]
```
### SEE ALSO
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo import"
slug: hugo_import
url: /commands/hugo_import/
@@ -10,7 +10,6 @@ Import your site from others.
### Synopsis
Import your site from other web site generators like Jekyll.
Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_path`.
@@ -34,7 +33,8 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo import jekyll"
slug: hugo_import_jekyll
url: /commands/hugo_import_jekyll/
@@ -10,7 +10,6 @@ hugo import from Jekyll
### Synopsis
hugo import from Jekyll.
Import from Jekyll requires two paths, e.g. `hugo import jekyll jekyll_root_path target_path`.
@@ -39,6 +38,7 @@ hugo import jekyll [flags]
```
### SEE ALSO
* [hugo import](/commands/hugo_import/) - Import your site from others.
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo list"
slug: hugo_list
url: /commands/hugo_list/
@@ -10,7 +10,6 @@ Listing out various types of content
### Synopsis
Listing out various types of content.
List requires a subcommand, e.g. `hugo list drafts`.
@@ -35,9 +34,10 @@ List requires a subcommand, e.g. `hugo list drafts`.
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo list drafts](/commands/hugo_list_drafts/) - List all drafts
* [hugo list expired](/commands/hugo_list_expired/) - List all posts already expired
* [hugo list future](/commands/hugo_list_future/) - List all posts dated in the future
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo list drafts"
slug: hugo_list_drafts
url: /commands/hugo_list_drafts/
@@ -10,7 +10,6 @@ List all drafts
### Synopsis
List all of the drafts in your content directory.
```
@@ -37,6 +36,7 @@ hugo list drafts [flags]
```
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo list expired"
slug: hugo_list_expired
url: /commands/hugo_list_expired/
@@ -10,7 +10,6 @@ List all posts already expired
### Synopsis
List all of the posts in your content directory which has already
expired.
@@ -38,6 +37,7 @@ hugo list expired [flags]
```
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo list future"
slug: hugo_list_future
url: /commands/hugo_list_future/
@@ -10,7 +10,6 @@ List all posts dated in the future
### Synopsis
List all of the posts in your content directory which will be
posted in the future.
@@ -38,6 +37,7 @@ hugo list future [flags]
```
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo new"
slug: hugo_new
url: /commands/hugo_new/
@@ -10,7 +10,6 @@ Create new content for your site
### Synopsis
Create a new content file and automatically set the date and title.
It will guess which kind of file to create based on the path provided.
@@ -44,8 +43,9 @@ hugo new [path] [flags]
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton)
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo new site"
slug: hugo_new_site
url: /commands/hugo_new_site/
@@ -10,7 +10,6 @@ Create a new site (skeleton)
### Synopsis
Create a new site in the provided directory.
The new site will have the correct structure, but no content or theme yet.
Use `hugo new [contentPath]` to create new content.
@@ -41,6 +40,7 @@ hugo new site [path] [flags]
```
### SEE ALSO
* [hugo new](/commands/hugo_new/) - Create new content for your site
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo new theme"
slug: hugo_new_theme
url: /commands/hugo_new_theme/
@@ -10,7 +10,6 @@ Create a new theme
### Synopsis
Create a new theme (skeleton) called [name] in the current directory.
New theme is a skeleton. Please add content to the touched files. Add your
name to the copyright line in the license and adjust the theme.toml file
@@ -40,6 +39,7 @@ hugo new theme [name] [flags]
```
### SEE ALSO
* [hugo new](/commands/hugo_new/) - Create new content for your site
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
+7 -10
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo server"
slug: hugo_server
url: /commands/hugo_server/
@@ -10,7 +10,6 @@ A high performance webserver
### Synopsis
Hugo provides its own webserver which builds and serves the site.
While hugo server is high performance, it is a webserver with limited options.
Many run it in production, but the standard behavior is for people to use it
@@ -38,16 +37,13 @@ hugo server [flags]
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-d, --destination string filesystem path to write files to
--disable404 do not render 404 page
--disableFastRender enables full re-renders on changes
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
--disableLiveReload watch without enabling live browser reload on rebuild
--disableRSS do not build RSS files
--disableSitemap do not build Sitemap file
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
@@ -62,9 +58,9 @@ hugo server [flags]
--noChmod don't sync permission mode of files
--noHTTPCache prevent HTTP caching
--noTimes don't sync modification time of files
--pluralizeListTitles pluralize titles in lists using inflect (default true)
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
-p, --port int port on which the server will listen (default 1313)
--preserveTaxonomyNames preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--renderToDisk render to Destination path (default is render to memory & serve from there)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
@@ -72,7 +68,7 @@ hugo server [flags]
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs if true, use /filename.html instead of /filename/
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
-w, --watch watch filesystem for changes and recreate as needed (default true)
```
@@ -89,6 +85,7 @@ hugo server [flags]
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
-43
View File
@@ -1,43 +0,0 @@
---
date: 2017-12-28T18:49:29+01:00
title: "hugo undraft"
slug: hugo_undraft
url: /commands/hugo_undraft/
---
## hugo undraft
Undraft resets the content's draft status
### Synopsis
Undraft resets the content's draft status
and updates the date to the current date and time.
If the content's draft status is 'False', nothing is done.
```
hugo undraft path/to/content [flags]
```
### Options
```
-h, --help help for undraft
```
### Options inherited from parent commands
```
--config string config file (default is path/config.yaml|json|toml)
--debug debug output
--log enable Logging
--logFile string log File path (if set, logging enabled automatically)
--quiet build in quiet mode
-v, --verbose verbose output
--verboseLog verbose logging
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 28-Dec-2017
+3 -3
View File
@@ -1,5 +1,5 @@
---
date: 2017-12-28T18:49:29+01:00
date: 2018-01-31T11:40:21+01:00
title: "hugo version"
slug: hugo_version
url: /commands/hugo_version/
@@ -10,7 +10,6 @@ Print the version number of Hugo
### Synopsis
All software has versions. This is Hugo's.
```
@@ -36,6 +35,7 @@ hugo version [flags]
```
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 28-Dec-2017
###### Auto generated by spf13/cobra on 31-Jan-2018
@@ -173,7 +173,7 @@ title = "post from custom archetype"
As an example of archetypes in practice, the following is the `functions` archetype from the Hugo docs:
{{< code file="archetypes/functions.md" >}}
{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md" >}}
{{< readfile file="/archetypes/functions.md" >}}
{{< /code >}}
{{% note %}}
@@ -103,6 +103,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables]
`expiryDate`
: the datetime at which the content should no longer be published by Hugo; expired content will not be rendered unless the `--buildExpired` flag is passed to the `hugo` command.
`headless`
: if `true`, sets a leaf bundle to be [headless][headless-bundle].
`isCJKLanguage`
: if `true`, Hugo will explicitly treat the content as a CJK language; both `.Summary` and `.WordCount` work properly in CJK languages.
@@ -127,6 +130,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables]
`publishDate`
: if in the future, content will not be rendered unless the `--buildFuture` flag is passed to `hugo`.
`resources`
: used for configuring page bundle resources. See [Page Resources][page-resources].
`slug`
: appears as the tail of the output URL. A value specified in front matter will override the segment of the URL based on the filename.
@@ -186,11 +192,13 @@ It's possible to set some options for Markdown rendering in a content's front ma
[content type]: /content-management/types/
[contentorg]: /content-management/organization/
[definetype]: /content-management/types/#defining-a-content-type "Learn how to specify a type and a layout in a content's front matter"
[headless-bundle]: /content-management/page-bundles/#headless-bundle
[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation"
[lists]: /templates/lists/#ordering-content "See how to order content in list pages; for example, templates that look to specific _index.md for content and front matter."
[lookup]: /templates/lookup-order/ "Hugo traverses your templates in a specific order when rendering content to allow for DRYer templating."
[ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates"
[outputs]: /templates/output-formats/ "With the release of v22, you can output your content to any text format using Hugo's familiar templating"
[page-resources]: /content-management/page-resources/
[pagevars]: /variables/page/
[section]: /content-management/sections/
[taxweight]: /content-management/taxonomies/
@@ -0,0 +1,141 @@
---
title: "Image Processing"
description: "Image Page resources can be resized and cropped."
date: 2018-01-24T13:10:00-05:00
lastmod: 2018-01-26T15:59:07-05:00
linktitle: "Image Processing"
categories: ["content management"]
keywords: [bundle,content,resources,images]
weight: 4004
draft: false
toc: true
menu:
docs:
parent: "content-management"
weight: 32
---
## The Image Page Resource
The `image` is a [Page Resource]({{< relref "content-management/page-resources" >}}), and the processing methods listed below does not work on images inside your `/static` folder.
To get all images in a [Page Bundle]({{< relref "content-management/organization#page-bundles" >}}):
```html
{{ with .Resources.ByType "image" }}
{{ end }}
```
## Image Processing Methods
The `image` resource implements the methods `Resize`, `Fit` and `Fill`, each returning the transformed image using the specified dimensions and processing options.
Resize
: Resizes the image to the specified width and height.
```go
// Resize to a width of 600px and preserve ratio
{{ $image := $resource.Resize "600x" }}
// Resize to a height of 400px and preserve ratio
{{ $image := $resource.Resize "x400" }}
// Resize to a width 600px and a height of 400px
{{ $image := $resource.Resize "600x400" }}
```
Fit
: Scale down the image to fit the given dimensions while maintaining aspect ratio. Both height and width are required.
```go
{{ $image := $resource.Fit "600x400" }}
```
Fill
: Resize and crop the image to match the given dimensions. Both height and width are required.
```go
{{ $image := $resource.Fill "600x400" }}
```
{{% note %}}
Image operations in Hugo currently **do not preserve EXIF data** as this is not supported by Go's [image package](https://github.com/golang/go/search?q=exif&type=Issues&utf8=%E2%9C%93). This will be improved on in the future.
{{% /note %}}
## Image Processing Options
In addition to the dimensions (e.g. `600x400`), Hugo supports a set of additional image options.
JPEG Quality
: Only relevant for JPEG images, values 1 to 100 inclusive, higher is better. Default is 75.
```go
{{ $image.Resize "600x q50" }}
```
Rotate
: Rotates an image by the given angle counter-clockwise. The rotation will be performed first to get the dimensions correct. The main use of this is to be able to manually correct for [EXIF orientation](https://github.com/golang/go/issues/4341) of JPEG images.
```go
{{ $image.Resize "600x r90" }}
```
Anchor
: Only relevant for the `Fill` method. This is useful for thumbnail generation where the main motive is located in, say, the left corner.
Valid are `Center`, `TopLeft`, `Top`, `TopRight`, `Left`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`.
```go
{{ $image.Fill "300x200 BottomLeft" }}
```
Resample Filter
: Filter used in resizing. Default is `Box`, a simple and fast resampling filter appropriate for downscaling.
Examples are: `Box`, `NearestNeighbor`, `Linear`, `Gaussian`.
See https://github.com/disintegration/imaging for more. If you want to trade quality for faster processing, this may be a option to test.
```go
{{ $image.Resize "600x400 Gaussian" }}
```
### Image Processing Examples
_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_
{{< imgproc sunset Resize "300x" />}}
{{< imgproc sunset Fill "90x120 left" />}}
{{< imgproc sunset Fill "90x120 right" />}}
{{< imgproc sunset Fit "90x90" />}}
{{< imgproc sunset Resize "300x q10" />}}
This is the shortcode used in the examples above:
{{< code file="layouts/shortcodes/imgproc.html" >}}
{{< readfile file="layouts/shortcodes/imgproc.html" >}}
{{< /code >}}
And it is used like this:
```html
{{</* imgproc sunset Resize "300x" /*/>}}
```
{{% note %}}
**Tip:** Note the self-closing shortcode syntax above. The `imgproc` shortcode can be called both with and without **inner content**.
{{% /note %}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

+15 -15
View File
@@ -13,11 +13,11 @@ menu:
weight: 150
weight: 150 #rem
draft: false
aliases: [/content/multilingual/,/content-management/multilingual/]
aliases: [/content/multilingual/,/content-management/multilingual/,/tutorials/create-a-multilingual-site/]
toc: true
---
You should define the available languages in a `Languages` section in your site configuration.
You should define the available languages in a `languages` section in your site configuration.
## Configure Languages
@@ -30,24 +30,24 @@ copyright = "Everything is mine"
[params.navigation]
help = "Help"
[Languages]
[Languages.en]
[languages]
[languages.en]
title = "My blog"
weight = 1
[Languages.en.params]
linkedin = "english-link"
[Languages.fr]
[languages.fr]
copyright = "Tout est à moi"
title = "Mon blog"
weight = 2
[Languages.fr.params]
linkedin = "lien-francais"
[Languages.fr.navigation]
# skip params key for front matter
[languages.fr.navigation]
help = "Aide"
{{< /code >}}
Anything not defined in a `[Languages]` block will fall back to the global
Anything not defined in a `[languages]` block will fall back to the global
value for that key (e.g., `copyright` for the English [`en`] language).
With the configuration above, all content, sitemap, RSS feeds, paginations,
@@ -118,17 +118,17 @@ tag = "tags"
angledQuotes = true
hrefTargetBlank = true
[Languages]
[Languages.en]
[languages]
[languages.en]
weight = 1
title = "English"
[Languages.en.blackfriday]
[languages.en.blackfriday]
angledQuotes = false
[Languages.fr]
[languages.fr]
weight = 2
title = "Français"
[Languages.fr.Taxonomies]
[languages.fr.Taxonomies]
plaque = "plaques"
{{< /code >}}
@@ -188,7 +188,7 @@ To create a list of links to translated content, use a template similar to the f
{{ end }}
{{< /code >}}
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page, or if there are translations---in the case of the homepage, section listing, etc.---a site with only render one language.
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page.
The above also uses the [`i18n` function][i18func] described in the next section.
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [content management,fundamentals]
keywords: [sections,content,organization]
keywords: [sections,content,organization,bundle,resources]
menu:
docs:
parent: "content-management"
@@ -17,9 +17,24 @@ aliases: [/content/sections/]
toc: true
---
{{< youtube 0GZxidrlaRM >}}
## Page Bundles
Hugo `0.32` announced page-relative images and other resources packaged into `Page Bundles`.
These terms are connected, and you also need to read about [Page Resources]({{< relref "content-management/page-resources" >}}) and [Image Processing]({{< relref "content-management/image-processing" >}}) to get the full picture.
{{% imgproc 1-featured Resize "300x" %}}
The illustration shows 3 bundles. Note that the home page bundle cannot contain other content pages, but other files (images etc.) are fine.
{{% /imgproc %}}
{{% note %}}
The bundle docuementation is **work in progress**. We will publish more comprehensive docs about this soon.
{{% /note %}}
# Organization of Content Source
## Organization of Content Source
In Hugo, your content should be organized in a manner that reflects the rendered website.
@@ -0,0 +1,182 @@
---
title : "Page Bundles"
description : "Content organization using Page Bundles"
date : 2018-01-24T13:09:00-05:00
lastmod : 2018-01-28T22:26:40-05:00
linktitle : "Page Bundles"
keywords : ["page", "bundle", "leaf", "branch"]
categories : ["content management"]
draft : true
toc : true
menu :
docs:
identifier : "page-bundles"
parent : "content-management"
weight : 11
---
Page Bundles are a way to organize the content files. It's useful for
cases where a page or section's content needs to be split into
multiple content pages for convenience or has associated attachments
like documents or images.
A Page Bundle can be one of two types:
- Leaf Bundle
- Branch Bundle
| | Leaf Bundle | Branch Bundle |
|-----------------|--------------------------------------------------------|---------------------------------------------------------|
| Usage | Collection of content and attachments for single pages | Collection of content and attachments for section pages |
| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] |
| Layout type | `single` | `list` |
| Nesting | Doesn't allow nesting of more bundles under it | Allows nesting of leaf/branch bundles under it |
| Example | `content/posts/my-post/index.md` | `content/posts/_index.md` |
## Leaf Bundles {#leaf-bundles}
A _Leaf Bundle_ is a directory at any hierarchy within the `content/`
directory, that contains at least an **`index.md`** file.
{{% note %}}
Here `md` (markdown) is used just as an example. You can use any file
type as a content resource as long as it is a MIME type recognized by
Hugo (`json` files will, as one example, work fine). If you want to
get exotic, you can define your own media type.
{{% /note %}}
### Examples of Leaf Bundle organization {#examples-of-leaf-bundle-organization}
```text
content/
├── about
│ ├── index.md
├── posts
│ ├── my-post
│ │ ├── content1.md
│ │ ├── content2.md
│ │ ├── image1.jpg
│ │ ├── image2.png
│ │ └── index.md
│ └── my-another-post
   └── index.md
└── another-section
├── ..
   └── not-a-leaf-bundle
├── ..
   └── another-leaf-bundle
   └── index.md
```
In the above example `content/` directory, there are four leaf
bundles:
about
: This leaf bundle is at the root level (directly under
`content` directory) and has only the `index.md`.
my-post
: This leaf bundle has the `index.md`, two other content
Markdown files and two image files.
my-another-post
: This leaf bundle has only the `index.md`.
another-leaf-bundle
: This leaf bundle is nested under couple of
directories. This bundle also has only the `index.md`.
{{% note %}}
The hierarchy depth at which a leaf bundle is created does not matter,
as long as it is not inside another **leaf** bundle.
{{% /note %}}
### Headless Bundle {#headless-bundle}
A headless bundle is a bundle that is configured to not get published
anywhere:
- 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`. Here is an example:
```html
{{ $headless := .Site.GetPage "page" "some-headless-bundle" }}
{{ $reusablePages := $headless.Resources.Match "author*" }}
<h2>Authors</h2>
{{ range $reusablePages }}
<h3>{{ .Title }}</h3>
{{ .Content }}
{{ end }}
```
A leaf bundle can be made headless by adding below in the Front Matter
(in the `index.md`):
```toml
headless = true
```
{{% note %}}
Only leaf bundles can be made headless.
{{% /note %}}
There are many use cases of such headless page bundles:
- Shared media galleries
- Reusable page content "snippets"
## Branch Bundles {#branch-bundles}
A _Branch Bundle_ is any directory at any hierarchy within the
`content/` directory, that contains at least an **`_index.md`** file.
This `_index.md` can also be directly under the `content/` directory.
{{% note %}}
Here `md` (markdown) is used just as an example. You can use any file
type as a content resource as long as it is a MIME type recognized by
Hugo (`json` files will, as one example, work fine). If you want to
get exotic, you can define your own media type.
{{% /note %}}
### Examples of Branch Bundle organization {#examples-of-branch-bundle-organization}
```text
content/
├── branch-bundle-1
│   ├── branch-content1.md
│   ├── branch-content2.md
│   ├── image1.jpg
│   ├── image2.png
│   └── _index.md
└── branch-bundle-2
├── _index.md
└── a-leaf-bundle
└── index.md
```
In the above example `content/` directory, there are two branch
bundles (and a leaf bundle):
`branch-bundle-1`
: This branch bundle has the `_index.md`, two
other content Markdown files and two image files.
`branch-bundle-2`
: This branch bundle has the `_index.md` and a
nested leaf bundle.
{{% note %}}
The hierarchy depth at which a branch bundle is created does not
matter.
{{% /note %}}
[^fn:1]: The `.md` extension is just an example. The extension can be `.html`, `.json` or any of any valid MIME type.
@@ -0,0 +1,184 @@
---
title : "Page Resources"
description : "Page Resources -- images, other pages, documents etc. -- have page-relative URLs and their own metadata."
date: 2018-01-24
categories: ["content management"]
keywords: [bundle,content,resources]
weight: 4003
draft: false
toc: true
linktitle: "Page Resources"
menu:
docs:
parent: "content-management"
weight: 31
---
## Properties
ResourceType
: The main type of the resource. For example, a file of MIME type `image/jpg` has for ResourceType `image`.
Name
: Default value is the filename (relative to the owning page). Can be set in front matter.
Title
: Default blank. Can be set in front matter.
Permalink
: The absolute URL to the resource. Resources of type `page` will have no value.
RelPermalink
: The relative URL to the resource. Resources of type `page` will have no value.
## Methods
ByType
: Returns the page resources of the given type.
```go
{{ .Resources.ByType "image" }}
```
Match
: Returns all the page resources (as a slice) whose `Name` matches the given Glob pattern ([examples](https://github.com/gobwas/glob/blob/master/readme.md)). The matching is case-insensitive.
```go
{{ .Resources.Match "images/*" }}
```
GetMatch
: Same as `Match` but will return the first match.
### Pattern Matching
```go
// Using Match/GetMatch to find this images/sunset.jpg ?
.Resources.Match "images/sun*"
.Resources.Match "**/Sunset.jpg"
.Resources.Match "images/*.jpg"
.Resources.Match "**.jpg"
.Resources.Match "*" 🚫
.Resources.Match "sunset.jpg" 🚫
.Resources.Match "*sunset.jpg" 🚫
```
## Page Resources Metadata
Page Resources' metadata is managed from their page's front matter with an array/table parameter named `resources`. You can batch assign values using a [wildcards](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm).
{{% note %}}
Resources of type `page` get `Title` etc. from their own front matter.
{{% /note %}}
name
: Sets the value returned in `Name`.
{{% warning %}}
The methods `Match` and `GetMatch` use `Name` to match the resources.
{{%/ warning %}}
title
: Sets the value returned in `Title`
params
: A map of custom key/values.
### Resources metadata: YAML Example
~~~yaml
title: Application
date : 2018-01-25
resources :
- src : "images/sunset.jpg"
name : "header"
- src : "documents/photo_specs.pdf"
title : "Photo Specifications"
params:
icon : "photo"
- src : "documents/guide.pdf"
title : "Instruction Guide"
- src : "documents/checklist.pdf"
title : "Document Checklist"
- src : "documents/payment.docx"
title : "Proof of Payment"
- src : "**.pdf"
name : "pdf-file-:counter"
params :
icon : "pdf"
- src : "**.docx"
params :
icon : "word"
~~~
### Resources metadata: TOML Example
~~~toml
title = Application
date : 2018-01-25
[[resources]]
src = "images/sunset.jpg"
name = "header"
[[resources]]
src = "documents/photo_specs.pdf"
title = "Photo Specifications"
[resources.params]
icon = "photo"
[[resources]]
src = "documents/guide.pdf"
title = "Instruction Guide"
[[resources]]
src = "documents/checklist.pdf"
title = "Document Checklist"
[[resources]]
src = "documents/payment.docx"
title = "Proof of Payment"
[[resources]]
src = "**.pdf"
name = "pdf-file-:counter"
[resources.params]
icon = "pdf"
[[resources]]
src = "**.docx"
[resources.params]
icon = "word"
~~~
From the example above:
- `sunset.jpg` will receive a new `Name` and can now be found with `.GetMatch "header"`.
- `documents/photo_specs.pdf` will get the `photo` icon.
- `documents/checklist.pdf`, `documents/guide.pdf` and `documents/payment.docx` will get `Title` as set by `title`.
- Every `PDF` in the bundle except `documents/photo_specs.pdf` will get the `pdf` icon.
- All `PDF` files will get a new `Name`. The `name` parameter contains a special placeholder [`:counter`](#counter), so the `Name` will be `pdf-file-1`, `pdf-file-2`, `pdf-file-3`.
- Every docx in the bundle will receive the `word` icon.
{{% warning %}}
The __order matters__ --- Only the **first set** values of the `title`, `name` and `params`-**keys** will be used. Consecutive parameters will be set only for the ones not already set. For example, in the above example, `.Params.icon` is already first set to `"photo"` in `src = "documents/photo_specs.pdf"`. So that would not get overridden to `"pdf"` by the later set `src = "**.pdf"` rule.
{{%/ warning %}}
### The `:counter` placeholder in `name` and `title`
The `:counter` is a special placeholder recognized in `name` and `title` parameters `resources`.
The counter starts at 1 the first time they are used in either `name` or `title`.
For example, if a bundle has the resources `photo_specs.pdf`, `other_specs.pdf`, `guide.pdf` and `checklist.pdf`, and the front matter has specified the `resources` as:
~~~toml
[[resources]]
src = "*specs.pdf"
title = "Specification #:counter"
[[resources]]
src = "**.pdf"
name = "pdf-file-:counter"
~~~
the `Name` and `Title` will be assigned to the resource files as follows:
| Resource file | `Name` | `Title` |
|-------------------|-------------------|-----------------------|
| checklist.pdf | `"pdf-file-1.pdf` | `"checklist.pdf"` |
| guide.pdf | `"pdf-file-2.pdf` | `"guide.pdf"` |
| other\_specs.pdf | `"pdf-file-3.pdf` | `"Specification #1"` |
| photo\_specs.pdf | `"pdf-file-4.pdf` | `"Specification #2"` |
@@ -240,7 +240,7 @@ If you need to add custom metadata to your taxonomy terms, you will need to crea
---
{{< /code >}}
You can later use your custom metadata as shown in the [Taxonomy Terms Templates documentation](/templates/taxonomy-templates/#displaying-custom-meta-data-in-taxonomy-terms-templates).
You can later use your custom metadata as shown in the [Taxonomy Terms Templates documentation](/templates/taxonomy-templates/#displaying-custom-metadata-in-taxonomy-terms-templates).
[`urlize` template function]: /functions/urlize/
[content section]: /content-management/sections/
+2 -2
View File
@@ -46,10 +46,10 @@ Once you have cloned the Hugo repository, you can create a new function via the
hugo new functions/newfunction.md
```
The archetype for `functions` according to the Hugo theme is as follows:
The archetype for `functions` according to the Hugo docs is as follows:
{{< code file="archetypes/functions.md" >}}
{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md">}}
{{< readfile file="/archetypes/functions.md">}}
{{< /code >}}
#### New Function Required Fields
+26
View File
@@ -0,0 +1,26 @@
---
title: "cond"
date: 2017-09-08
description: "Return one of two arguments, depending on the value of a third argument."
categories: [functions]
menu:
docs:
parent: "functions"
signature: ["cond CONTROL VAR1 VAR2"]
aliases: [/functions/cond/]
hugoversion: 0.27
relatedfuncs: [default]
toc: false
draft: false
needsexamples: false
---
`cond` returns *VAR1* if *CONTROL* is true, or *VAR2* if it is not.
Example:
```
{{ cond (eq (len $geese) 1) "goose" "geese" }}
```
Would emit "goose" if the `$geese` array has exactly 1 item, or "geese" otherwise.
+25
View File
@@ -24,3 +24,28 @@ Useful for turning strings into numbers.
```
{{ int "123" }} → 123
```
{{% note "Usage Note" %}}
If the input string is supposed to represent a decimal number, and if it has
leading 0's, then those 0's will have to be removed before passing the string
to the `int` function, else that string will be tried to be parsed as an octal
number representation.
The [`strings.TrimLeft` function](/functions/strings.trimleft/) can be used for
this purpose.
```
{{ int ("0987" | strings.TrimLeft "0") }}
{{ int ("00987" | strings.TrimLeft "0") }}
```
**Explanation**
The `int` function eventually calls the `ParseInt` function from the Go library
`strconv`.
From its [documentation](https://golang.org/pkg/strconv/#ParseInt):
> the base is implied by the string's prefix: base 16 for "0x", base 8 for "0",
> and base 10 otherwise.
{{% /note %}}
@@ -73,7 +73,6 @@ canonifyURLs: false
config: "config.toml"
contentDir: "content"
dataDir: "data"
defaultExtension: "html"
defaultLayout: "post"
# Missing translations will default to this content language
defaultContentLanguage: "en"
@@ -216,7 +215,6 @@ canonifyURLs = false
config = "config.toml"
contentDir = "content"
dataDir = "data"
defaultExtension = "html"
defaultLayout = "post"
# Missing translations will default to this content language
defaultContentLanguage = "en"
+11 -3
View File
@@ -4,7 +4,7 @@ linktitle: Install Hugo
description: Install Hugo on macOS, Windows, Linux, FreeBSD, and on any machine where the Go compiler tool chain can run.
date: 2016-11-01
publishdate: 2016-11-01
lastmod: 2017-02-20
lastmod: 2018-01-02
categories: [getting started,fundamentals]
authors: ["Michael Henderson"]
keywords: [install,pc,windows,linux,macos,binary,tarball]
@@ -66,7 +66,7 @@ choco install hugo -confirm
#### Prerequisite Tools
* [Git][installgit]
* [Go 1.5+][installgo]
* [Go (latest or previous version)][installgo]
* [govendor][]
#### Vendored Dependencies
@@ -453,7 +453,15 @@ You can also install Hugo from the Arch Linux [community](https://www.archlinux.
sudo pacman -Sy hugo
```
### Fedora, CentOS, and Red Hat
### Fedora
Fedora provides a package for Hugo. The installation is done with the command :
```
sudo dnf install hugo
```
### CentOS, and Red Hat
* <https://copr.fedorainfracloud.org/coprs/daftaupe/hugo/>
-1
View File
@@ -53,7 +53,6 @@ Available Commands:
list Listing out various types of content
new Create new content for your site
server A high performance webserver
undraft Undraft resets the content's draft status
version Print the version number of Hugo
Flags:
@@ -115,8 +115,8 @@ Do this by adding a custom install script at the root of your project that will
if [[ ! -f /data/bin/hugo ]]; then
cd /tmp
wget https://github.com/gohugoio/hugo/releases/download/v0.25.1/hugo_0.25.1_Linux-64bit.tar.gz
tar -xzf hugo_0.25.1_Linux-64bit.tar.gz
wget https://github.com/gohugoio/hugo/releases/download/v0.31.1/hugo_0.31.1_Linux-64bit.tar.gz
tar -xzf hugo_0.31.1_Linux-64bit.tar.gz
mv hugo /data/bin/hugo
cd -
rm -rf /tmp/*
@@ -127,6 +127,9 @@ fi
{{% note %}}
If the install script fails during `nanobox run` you may need to make it executable with `chmod +x install.sh`
{{% /note %}}
{{% note %}}
Make sure to check the version of Hugo you have installed and update the install script to match.
{{% /note %}}
### Generating a New Hugo App
@@ -75,13 +75,9 @@ hugo new about.md
The preceding example for the about page leverages archetypes to scaffold a new content file with preconfigured front matter. [Find out more about Hugo's archetypes](/content-management/archetypes/).
{{% /note %}}
Now you can edit `contents/about.md` in your text editor of choice, but this is not necessary for the purposes of this guide. Running the following command will build your Hugo site into the `public` directory. We have added `undraft` to ensure that the example page is no longer in draft mode:
Now you can edit `contents/about.md` in your text editor of choice, but this is not necessary for the purposes of this guide. Running the following command will build your Hugo site into the `public` directory.
{{< code file="hugo-build-undraft.sh" >}}
hugo undraft content/about.md
{{< /code >}}
Once the website is build, t's a good idea to run the following command to start a local server and ensure you're changes have been implemented:
Once the website is build, it's a good idea to run the following command to start a local server and ensure you're changes have been implemented:
```
hugo server --theme=herring-cove
@@ -27,13 +27,84 @@ GitHub provides free and fast static hosting over SSL for personal, organization
2. You have a GitHub account. [Signing up][ghsignup] for GitHub is free.
3. You have a ready-to-publish Hugo website or have at least completed the [Quick Start][].
If you are working within an Organization account or want to set up a User website on GitHub and would like more information, refer to the [GitHub Pages documentation][ghorgs].
## Types of GitHub Pages
There are 2 types of GitHub Pages:
- User/Organization Pages (`https://<USERNAME|ORGANIZATION>.github.io/`)
- Project Pages (`https://<USERNAME|ORGANIZATION>.github.io/<PROJECT>/`)
Please refer to the [GitHub Pages documentation][ghorgs] to decide which type of site you would like to create as it will determine which of the below methods to use.
To create a User/Organization Pages site, follow the single method in the *GitHub User and Organization Pages* section below.
To create a Project Pages site, choose a method from the *Project Pages* section below.
## GitHub User or Organization Pages
As mentioned [the GitHub Pages documentation][ghorgs], you can host a user/organization page in addition to project pages. Here are the key differences in GitHub Pages websites for Users and Organizations:
1. You must use a `<USERNAME>.github.io` to host your **generated** content
2. Content from the `master` branch will be used to publish your GitHub Pages site
This is a much simpler setup as your Hugo files and generated content are published into two different repositories.
### Step-by-step Instructions
1. Create a `<YOUR-PROJECT>` (e.g. `blog`) repository on GitHub. This repository will contain Hugo's content and other source files.
2. Create a `<USERNAME>.github.io` GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
3. `git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>`
4. Make your website work locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
5. Once you are happy with the results:
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to kill the server
* `rm -rf public` to completely remove the `public` directory
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.
### Put it Into a Script
You're almost done. You can also add a `deploy.sh` script to automate the preceding steps for you. You can also make it executable with `chmod +x deploy.sh`.
The following are the contents of the `deploy.sh` script:
```
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
# Go To Public folder
cd public
# Add changes to git.
git add .
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# Come Back up to the Project Root
cd ..
```
You can then run `./deploy.sh "Your optional commit message"` to send changes to `<USERNAME>.github.io`. Note that you likely will want to commit changes to your `<YOUR-PROJECT>` repository as well.
That's it! Your personal page should be up and running at `https://<USERNAME>.github.io` within a couple minutes.
## GitHub Project Pages
{{% note %}}
Make sure your `baseURL` key-value in your [site configuration](/getting-started/configuration/) reflects the full URL of your GitHub pages repository if you're using the default GH Pages URL (e.g., `username.github.io/myprojectname/`) and not a custom domain.
Make sure your `baseURL` key-value in your [site configuration](/getting-started/configuration/) reflects the full URL of your GitHub pages repository if you're using the default GH Pages URL (e.g., `<USERNAME>.github.io/<PROJECT>/`) and not a custom domain.
{{% /note %}}
## Deployment via `/docs` Folder on Master Branch
### Deployment of Project Pages from `/docs` folder on `master` branch
[As described in the GitHub Pages documentation][ghpfromdocs], you can deploy from a folder called `docs/` on your master branch. To effectively use this feature with Hugo, you need to change the Hugo publish directory in your [site's][config] `config.toml` and `config.yaml`, respectively:
@@ -53,18 +124,18 @@ After running `hugo`, push your master branch to the remote repository and choos
The `docs/` option is the simplest approach but requires you set a publish directory in your site configuration. You cannot currently configure GitHub pages to publish from another directory on master, and not everyone prefers the output site live concomitantly with source files in version control.
{{% /note %}}
## Deployment From Your `gh-pages` Branch
### Deployment of Project Pages From Your `gh-pages` branch
You can also tell GitHub pages to treat your `master` branch as the published site or point to a separate `gh-pages` branch. The latter approach is a bit more complex but has some advantages:
* It keeps your source and generated website in different branches and therefore maintains version control history for both.
* Unlike the preceding `docs/` option, it uses the default `public` folder.
### Preparations for `gh-pages` Branch
#### Preparations for `gh-pages` Branch
These steps only need to be done once. Replace `upstream` with the name of your remote; e.g., `origin`:
#### Add the Public Folder
##### Add the `public` Folder
First, add the `public` folder to your `.gitignore` file at the project root so that the directory is ignored on the master branch:
@@ -72,7 +143,7 @@ First, add the `public` folder to your `.gitignore` file at the project root so
echo "public" >> .gitignore
```
#### Initialize Your `gh-pages` Branch
##### Initialize Your `gh-pages` Branch
You can now initialize your `gh-pages` branch as an empty [orphan branch][]:
@@ -84,7 +155,7 @@ git push upstream gh-pages
git checkout master
```
### Build and Deployment
#### Build and Deployment
Now check out the `gh-pages` branch into your `public` folder using git's [worktree feature][]. Essentially, the worktree allows you to have multiple branches of the same local repository to be checked out in different directories:
@@ -106,7 +177,7 @@ If the changes in your local `gh-pages` branch look alright, push them to the re
git push upstream gh-pages
```
#### Set `gh-pages` as Your Publish Branch
##### Set `gh-pages` as Your Publish Branch
In order to use your `gh-pages` branch as your publishing branch, you'll need to configure the repository within the GitHub UI. This will likely happen automatically once GitHub realizes you've created this branch. You can also set the branch manually from within your GitHub project:
@@ -115,7 +186,7 @@ In order to use your `gh-pages` branch as your publishing branch, you'll need to
After a short while, you'll see the updated contents on your GitHub Pages site.
### Put it Into a Script
#### Put it Into a Script
To automate these steps, you can create a script with the following contents:
@@ -153,7 +224,7 @@ cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)
This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing. Or adding `echo yourdomainname.com >> CNAME` if you set up for your gh-pages to use customize domain.
## Deployment From Your `master` Branch
### Deployment of Project Pages from Your `master` Branch
To use `master` as your publishing branch, you'll need your rendered website to live at the root of the GitHub repository. Steps should be similar to that of the `gh-pages` branch, with the exception that you will create your GitHub repository with the `public` directory as the root. Note that this does not provide the same benefits of the `gh-pages` branch in keeping your source and output in separate, but version controlled, branches within the same repo.
@@ -162,64 +233,6 @@ You will also need to set `master` as your publishable branch from within the Gi
1. Go to **Settings** &rarr; **GitHub Pages**
2. From **Source**, select "master branch" and then **Save**.
## Host GitHub User or Organization Pages
As mentioned [in this GitHub Help article](https://help.github.com/articles/user-organization-and-project-pages/), you can host a user/organization page in addition to project pages. Here are the key differences in GitHub Pages websites for Users and Organizations:
1. You must use the `<USERNAME>.github.io` naming scheme for your GitHub repo.
2. Content from the `master` branch will be used to publish your GitHub Pages site.
It becomes much simpler in this case: we'll create two separate repos, one for Hugo's content, and a git submodule with the `public` folder's content in it.
### Step-by-step Instructions
1. Create a `<YOUR-PROJECT>` git repository on GitHub. This repository will contain Hugo's content and other source files.
2. Create a `<USERNAME>.github.io` GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
3. `git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>`
4. Make your website work locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
5. Once you are happy with the results:
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to kill the server
* `rm -rf public` to completely remove the `public` directory if there
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.
#### Put it Into a Script
You're almost done. You can also add a `deploy.sh` script to automate the preceding steps for you. You can also make it executable with `chmod +x deploy.sh`.
The following are the contents of the `deploy.sh` script:
```
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
# Go To Public folder
cd public
# Add changes to git.
git add .
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# Come Back up to the Project Root
cd ..
```
You can then run `./deploy.sh "Your optional commit message"` to send changes to `<USERNAME>.github.io`. Note that you likely will want to commit changes to your `<YOUR-PROJECT>` repository as well.
That's it! Your personal page should be up and running at `https://yourusername.github.io` within a couple minutes.
## Use a Custom Domain
If you'd like to use a custom domain for your GitHub Pages site, create a file `static/CNAME`. Your custom domain name should be the only contents inside `CNAME`. Since it's inside `static`, the published site will contain the CNAME file at the root of the published site, which is a requirements of GitHub Pages.
@@ -145,7 +145,7 @@ You now have a live website served over https, distributed through CDN, and conf
[ghsm]: https://github.com/blog/2104-working-with-submodules
[gitsm]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
[httpscustom]: https://www.netlify.com/docs/ssl/
[hugoversions]: https://github.com/netlify/build-image/blob/master/Dockerfile#L166
[hugoversions]: https://github.com/netlify/build-image/blob/master/Dockerfile#L216
[installthemes]: /themes/installing/
[netlify]: https://www.netlify.com/
[netlifysignup]: https://app.netlify.com/signup
+5 -3
View File
@@ -1,10 +1,12 @@
---
date: 2017-12-31
title: "0.32"
description: "0.32"
slug: "0.32"
title: "Hugo 0.32: Page Bundles and Image Processing!"
description: "Images and other resources with page-relative links, resize, scale and crop images, and much more."
slug: "0.32-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-32-poster.png
---
Hugo `0.32` features **Page Bundles and Image Processing** by [@bep](https://github.com/bep), which is very cool and useful on so many levels. Read about it in more detail in the [Hugo documentation](https://gohugo.io/about/new-in-032/), but some of the highlights include:
@@ -0,0 +1,19 @@
---
date: 2018-01-02
title: "0.32.1: Two bugfixes"
description: "Fixes image processing in shortcodes."
slug: "0.32.1-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
This fixes 2 bugs from the Hugo 0.32 release.
* Fix image processing from shortcodes in non-server mode. [@bep](https://github.com/bep) [#4202](https://github.com/gohugoio/hugo/issues/4202)
* Fix broken `hugo --renderToMemory`. Note that this is only useful for benchmark testing, as there is no easy way to actually view the result. [d36d71ed](https://github.com/gohugoio/hugo/commit/d36d71edd3b04df3b34edf4d108e3995a244c4f0) [@bep](https://github.com/bep) [#4212](https://github.com/gohugoio/hugo/issues/4212)
@@ -0,0 +1,24 @@
---
date: 2018-01-03
title: "0.32.2: One bugfix"
description: "Fixes one issue with publishing of processed images when no cache."
slug: "0.32.2-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
This is a bug-fix release with one important fix.
* Handle publish of processed images to /public on fresh build with no image cache in /resources (as reported by one person in a Netlify build) [196da49c](https://github.com/gohugoio/hugo/commit/196da49c9d906fbae6d389fdd32b80c27cb38de4) [@bep](https://github.com/bep) [#4213](https://github.com/gohugoio/hugo/issues/4213)
@@ -0,0 +1,31 @@
---
date: 2018-01-08
title: "Hugo 0.32.3: Some important bug fixes"
description: "Fixes multilingual resource (images etc.) handling etc."
slug: "0.32.3-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
Hugo `0.32` was a big and [really cool](https://gohugo.io/news/0.32-relnotes/) release, and the [Hugo Forum](https://discourse.gohugo.io/) has been filled with questions from people wanting to upgrade their Hugo sites to be able to use the new image processing feature etc.
And with that we have discovered some issues, which this release should fix, mostly releated to multilingual sites:
* Fix multihost detection for sites without language definition [8969331f](https://github.com/gohugoio/hugo/commit/8969331f5be352939883074034adac6b7086ddc8) [@bep](https://github.com/bep) [#4221](https://github.com/gohugoio/hugo/issues/4221)
* Fix hugo benchmark --renderToMemory [059e8458](https://github.com/gohugoio/hugo/commit/059e8458d690dbb9fcd3ebd58cfc61b062d3138e) [@bep](https://github.com/bep) [#4218](https://github.com/gohugoio/hugo/issues/4218)
* Fix URLs for bundle resources in multihost mode [ab82a27d](https://github.com/gohugoio/hugo/commit/ab82a27d055c3aa177821d81a45a5c6e972aa29e) [@bep](https://github.com/bep) [#4217](https://github.com/gohugoio/hugo/issues/4217)
* Fix sub-folder baseURL handling for Page resources [f25d8a9e](https://github.com/gohugoio/hugo/commit/f25d8a9e17fb65fa41dafdcbf0358853d68eaf45) [@bep](https://github.com/bep) [#4228](https://github.com/gohugoio/hugo/issues/4228)
* Avoid processing and storing same image for each language [4b04db0f](https://github.com/gohugoio/hugo/commit/4b04db0f0855a1f54895d6c93c52dcea4b1ce3ca) [@bep](https://github.com/bep) [#4231](https://github.com/gohugoio/hugo/issues/4231)
* Resources.ByType should return Resources [97c1866e](https://github.com/gohugoio/hugo/commit/97c1866e322284dec46db6f3d235807507f5b69f) [@bep](https://github.com/bep) [#4234](https://github.com/gohugoio/hugo/issues/4234)
* Report build time on config.toml change [6feb1387](https://github.com/gohugoio/hugo/commit/6feb138785eeb9e813428d0df30010d9b5fb1059) [@bep](https://github.com/bep) [#4232](https://github.com/gohugoio/hugo/issues/4232)[#4224](https://github.com/gohugoio/hugo/issues/4224)
* Fix handling of mixed-case taxonomy folders with content file [2d3189b2](https://github.com/gohugoio/hugo/commit/2d3189b22760e0a8995dae082a6bc5480f770bfe) [@bep](https://github.com/bep) [#4238](https://github.com/gohugoio/hugo/issues/4238)
@@ -0,0 +1,21 @@
---
date: 2018-01-11
title: "0.32.4: Two bugfixes"
description: "Fixes non-ASCII path handling for Page resources."
slug: "0.32.4-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
This is a bug-fix release with two of important fixes.
* Fix non-ASCII path handling for Page resources [f0eecc6a](https://github.com/gohugoio/hugo/commit/f0eecc6a4f541838e9930c98bc982546f65c7a4f) [@bep](https://github.com/bep) [#4241](https://github.com/gohugoio/hugo/issues/4241)
* Fix `--cleanDestinationDir` [5235a5bf](https://github.com/gohugoio/hugo/commit/5235a5bf5ef44b3789341e1d25b681a7bb14771a) [@biodranik](https://github.com/biodranik) [#4246](https://github.com/gohugoio/hugo/issues/4246)[#4248](https://github.com/gohugoio/hugo/issues/4248)
+80
View File
@@ -0,0 +1,80 @@
---
date: 2018-01-18
title: "Hugo 0.33: The New Kinder Surprise!"
description: "Hugo 0.33 comes with resource (images etc.) metadata, `type` and `layout` for all page types, `url` in front matter for list pages …"
slug: "0.33-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-33-poster.png
---
Hugo `0.33` is the first main Hugo release of the new year, and it is safe to say that [@bep](https://github.com/bep) has turned off his lazy Christmas mode :smiley:
This is a full makeover of the layout selection logic with full custom `layout` and `type` support (many have asked for this). Also, Hugo now respects the `url` value in front matter for all page types, including sections. Also, you can now configure `uglyURLs` per section.
But this release is also a follow-up to the `0.32` release which was all about bundles with resources and powerful image processing. With this release it is now simple to add metadata to your images and other bundle resources.
[@bep](https://github.com/bep) has added a section with examples of both `resources` configuration in both `YAML` and `TOML` front matter in his [test site](http://hugotest.bep.is/resourcemeta/). The example below shows a sample of how it would look like in `YAML`:
```yaml
date: 2017-01-17
title: My Bundle With YAML Resource Metadata
resources:
- src: "image-4.png"
title: "The Fourth Image"
- src: "*.png"
name: "my-cool-image-:counter"
title: "The Image #:counter"
params:
byline: "bep"
```
This release represents **41 contributions by 3 contributors** to the main Hugo code base.
Hugo now has:
* 22553+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 197+ [themes](http://themes.gohugo.io/)
## Notes
* We have re-implemented and unified the template layout lookup logic. This has made it more powerful and much simpler to understand. We don't expect any sites to break because of this. We have tested lots of Hugo sites, including the 200 [themes](http://themes.gohugo.io/).
* The `indexes` type is removed from template lookup. It's not in the documentation, and is a legacy term inherited from very old Hugo versions.
* If you have sub-dirs in your shiny new bundles (e.g. `my-bundle/images`) and use the `*Prefix*` methods to find them, we have made an unintended change that affects you. See [this issue](https://github.com/gohugoio/hugo/issues/4295).
## Enhancements
### Templates
* Respect `Type` and `Layout` for list template selection [51dd462c](https://github.com/gohugoio/hugo/commit/51dd462c3958f7cf032b06503f1f200a6aceebb9) [@bep](https://github.com/bep) [#3005](https://github.com/gohugoio/hugo/issues/3005)[#3245](https://github.com/gohugoio/hugo/issues/3245)
### Core
* Allow `url` in front matter for list type pages [8a409894](https://github.com/gohugoio/hugo/commit/8a409894bdb0972e152a2eccc47a2738568e1cfc) [@bep](https://github.com/bep) [#4263](https://github.com/gohugoio/hugo/issues/4263)
* Improve `.Site.GetPage` for regular translated pages. Before this change it was not possible to say "get me the current language edition of the given content page if possible." Now you can do that by doing a lookup without any extensions: `.Site.GetPage "page" "post/mypost"` [9409bc0f](https://github.com/gohugoio/hugo/commit/9409bc0f799a8057836a14ccdf2833a55902175e) [@bep](https://github.com/bep) [#4285](https://github.com/gohugoio/hugo/issues/4285)
* Add front matter metadata to `Resource` [20c9b6ec](https://github.com/gohugoio/hugo/commit/20c9b6ec81171d1c586ea31d5d08b40b0edaffc6) [@bep](https://github.com/bep) [#4244](https://github.com/gohugoio/hugo/issues/4244)
* Implement `Resources.ByPrefix` [46db900d](https://github.com/gohugoio/hugo/commit/46db900dab9c0e6fcd9d227f10a32fb24f5c8bd9) [@bep](https://github.com/bep) [#4266](https://github.com/gohugoio/hugo/issues/4266)
* Make `GetByPrefix` work for Page resources [60c9f3b1](https://github.com/gohugoio/hugo/commit/60c9f3b1c34b69771e25a66906f150f460d73223) [@bep](https://github.com/bep) [#4264](https://github.com/gohugoio/hugo/issues/4264)
* Make `Resources.GetByPrefix` case insensitive [db85e834](https://github.com/gohugoio/hugo/commit/db85e83403913cff4b8737b138932b28e5bf6160) [@bep](https://github.com/bep) [#4258](https://github.com/gohugoio/hugo/issues/4258)
* Update `Chroma` and other third-party deps [64f0e9d1](https://github.com/gohugoio/hugo/commit/64f0e9d1c1d4ff2249fd9cf9749e70485002b36d) [@bep](https://github.com/bep) [#4267](https://github.com/gohugoio/hugo/issues/4267)
* Remove superflous `BuildDate` logic [13d53b31](https://github.com/gohugoio/hugo/commit/13d53b31f19240879122d6b7e4aaeb60b5130a3c) [@bep](https://github.com/bep) [#4272](https://github.com/gohugoio/hugo/issues/4272)
* Run benchmarks 3 times [b6ea6d07](https://github.com/gohugoio/hugo/commit/b6ea6d07d0b072d850fb066c78976acd6c2f5e81) [@bep](https://github.com/bep)
* Support `uglyURLs` per section [57e10f17](https://github.com/gohugoio/hugo/commit/57e10f174e51cc5e1cf5f37eed30a0f3b153dd64) [@bep](https://github.com/bep) [#4256](https://github.com/gohugoio/hugo/issues/4256)
* Update CONTRIBUTING.md [1046e936](https://github.com/gohugoio/hugo/commit/1046e9363f2e382fd0b4aac838735ae4cbbebe5a) [@vassudanagunta](https://github.com/vassudanagunta)
* Support offline builds [d5803da1](https://github.com/gohugoio/hugo/commit/d5803da1befba5446d1b2c1ad16f6467dc7b3991) [@vassudanagunta](https://github.com/vassudanagunta)
## Fixes
* Fix handling of mixed-case taxonomy folders with content file [2d3189b2](https://github.com/gohugoio/hugo/commit/2d3189b22760e0a8995dae082a6bc5480f770bfe) [@bep](https://github.com/bep) [#4238](https://github.com/gohugoio/hugo/issues/4238)
* Fix handling of very long image file names [ecaf1451](https://github.com/gohugoio/hugo/commit/ecaf14514e06321823bdd10235cf23e7d654ba77) [@bep](https://github.com/bep) [#4261](https://github.com/gohugoio/hugo/issues/4261)
* Update `Afero` to avoid panic on "file name is too long" [f8a119b6](https://github.com/gohugoio/hugo/commit/f8a119b606d55aa4f31f16e5a3cadc929c99e4f8) [@bep](https://github.com/bep) [#4240](https://github.com/gohugoio/hugo/issues/4240)
* And now really fix the server watch logic [d4f8f88e](https://github.com/gohugoio/hugo/commit/d4f8f88e67f958b8010f90cb9b9854114e52dac2) [@bep](https://github.com/bep) [#4275](https://github.com/gohugoio/hugo/issues/4275)
* Fix server without watch [4e524ffc](https://github.com/gohugoio/hugo/commit/4e524ffcfff48c017717e261c6067416aa56410f) [@bep](https://github.com/bep) [#4275](https://github.com/gohugoio/hugo/issues/4275)
+53
View File
@@ -0,0 +1,53 @@
---
date: 2018-01-22
title: "Hugo 0.34: Pattern matching to filter images and other resources"
description: "Hugo 0.34 adds full glob with super-asterisk support, for example `*.jpg`."
slug: "0.34-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-34-poster.png
---
Hugo `0.34` is a small release. It contains a few smaller bug-fixes, but more important is an overhaul of the API used to find images and other resources in your page bundles.
We have added two simple methods on the `Resources` object:
* `.Match` finds every resource matching a pattern. Examples: `.Match "images/*.jpg"` finds every JPEG image in `images` and `.Match "**.jpg"` finds every JPEG image in the bundle.
* `.GetMatch` finds the first resource matching the pattern given.
**Note: The path separators used are Unix-style forward slashes, even on Windows.**
It uses [standard wildcard syntax](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm) with the addition of the `**`, aka super-asterisk, which matches across path boundaries.
Thanks to [@gobwas](https://github.com/gobwas/glob) for a fast and easy-to-use Glob library.
This release represents **5 contributions by 1 contributors** to the main Hugo code base.
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **25 contributions by 16 contributors**. A special thanks to [@bep](https://github.com/bep), [@rmetzler](https://github.com/rmetzler), [@chris-rudmin](https://github.com/chris-rudmin), and [@stkevintan](https://github.com/stkevintan) for their work on the documentation site.
Hugo now has:
* 22689+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 197+ [themes](http://themes.gohugo.io/)
## Notes
* `Resources.GetByPrefix` and `Resources.ByPrefix` are depracated. They still work, but will eventually be removed. Use `Resources.Match` (many) and `Resources.GetMatch` (one).
* When filtering bundles pages in sub-folders, you need to include the sub-folder when matching. This was a bug introduced in `0.33` and gets it in line with images and other resources.
## Enhancements
* Add `Resources.Match` and `Resources.GetMatch` [94213801](https://github.com/gohugoio/hugo/commit/9421380168f66620cb73203e1267814b3086d805) [@bep](https://github.com/bep) [#4301](https://github.com/gohugoio/hugo/issues/4301)
## Fixes
* Add validation for `defaultContentLanguage` [4d5e4f37](https://github.com/gohugoio/hugo/commit/4d5e4f379a890a3c6cbc11ddb40d77a90f14c015) [@bep](https://github.com/bep) [#4298](https://github.com/gohugoio/hugo/issues/4298)
* Fix lookup of pages bundled in sub-folders in `ByPrefix` etc. [5d030869](https://github.com/gohugoio/hugo/commit/5d03086981b4a7d4bc450269a6a2e0fd22dbeed7) [@bep](https://github.com/bep) [#4295](https://github.com/gohugoio/hugo/issues/4295)
+102
View File
@@ -0,0 +1,102 @@
---
date: 2018-01-31
title: "0.35"
description: "0.35"
slug: "0.35"
categories: ["Releases"]
---
The most notable new feature in Hugo `0.35` is perhaps **Headless Bundles**.
This means that you in your `index.md` front matter can say:
```yaml
headless: true
```
And
* 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 libraries
* Reusable page content "snippets"
* ...
But this release contains more goodies than possible to sum up in one paragraph, so study the release notes carefully. It represents **42 contributions by 8 contributors** to the main Hugo code base.
[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@vassudanagunta](https://github.com/vassudanagunta), [@yanzay](https://github.com/yanzay), and [@robertbasic](https://github.com/robertbasic) for their ongoing contributions.
And as always a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the documentation and the themes site in pristine condition.
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **28 contributions by 5 contributors**. A special thanks to [@bep](https://github.com/bep), [@kaushalmodi](https://github.com/kaushalmodi), [@regisphilibert](https://github.com/regisphilibert), and [@salim-b](https://github.com/salim-b) for their work on the documentation site.
Hugo now has:
* 22967+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 197+ [themes](http://themes.gohugo.io/)
## Notes
* Deprecate `useModTimeAsFallback` [adfd4370](https://github.com/gohugoio/hugo/commit/adfd4370b67fd7181178bd6b3b1d07356beaac71) [@bep](https://github.com/bep) [#4351](https://github.com/gohugoio/hugo/issues/4351)
* Deprecate CLI flags `canonifyURLs`, `pluralizeListTitles`, `preserveTaxonomyNames`, `uglyURLs` [f08ea02d](https://github.com/gohugoio/hugo/commit/f08ea02d24d42929676756950f3affaca7fd8c01) [@bep](https://github.com/bep) [#4347](https://github.com/gohugoio/hugo/issues/4347)
* Remove undraft command [2fa70c93](https://github.com/gohugoio/hugo/commit/2fa70c9344b231c9d999bbafdfa4acbf27ed9f6e) [@robertbasic](https://github.com/robertbasic) [#4353](https://github.com/gohugoio/hugo/issues/4353)
## Enhancements
### Templates
* Update Twitter card to also consider images in `.Resources` [25d691da](https://github.com/gohugoio/hugo/commit/25d691daff57d7c6d7d0f63af3991d22e3f788fe) [@bep](https://github.com/bep) [#4349](https://github.com/gohugoio/hugo/issues/4349)
* Seed random on init only [83c761b7](https://github.com/gohugoio/hugo/commit/83c761b71a980aee6331179b271c7e24e999e8eb) [@liguoqinjim](https://github.com/liguoqinjim)
* Remove duplicate layout lookup layouts [b2fcbb1f](https://github.com/gohugoio/hugo/commit/b2fcbb1f9774aa1e929b8575c0e1ac366ab2fb73) [@bep](https://github.com/bep) [#4319](https://github.com/gohugoio/hugo/issues/4319)
* Add "removable-media" interface to `snapcraft.yaml` [f0c0ece4](https://github.com/gohugoio/hugo/commit/f0c0ece44d55b6c2997cbd106d1bc099ea1a2fa7) [@anthonyfok](https://github.com/anthonyfok) [#3837](https://github.com/gohugoio/hugo/issues/3837)
### Other
* Add a way to disable one or more languages [6413559f](https://github.com/gohugoio/hugo/commit/6413559f7575e2653d76227a8037a7edbaae82aa) [@bep](https://github.com/bep) [#4297](https://github.com/gohugoio/hugo/issues/4297)[#4329](https://github.com/gohugoio/hugo/issues/4329)
* Handle newly created files in Fast Render Mode [1707dae8](https://github.com/gohugoio/hugo/commit/1707dae8d3634006017eb6d040df4dbafc53d92f) [@yanzay](https://github.com/yanzay) [#4339](https://github.com/gohugoio/hugo/issues/4339)
* Extract the Fast Render Mode logic into a method [94e736c5](https://github.com/gohugoio/hugo/commit/94e736c5e167a0ee70a528e1c19d64a47e7929c2) [@bep](https://github.com/bep) [#4339](https://github.com/gohugoio/hugo/issues/4339)
* Remove unused code [ae5a45be](https://github.com/gohugoio/hugo/commit/ae5a45be6f0ee4d5c52b38fd28b22b55d9cd7b2d) [@bep](https://github.com/bep)
* Add the last lookup variant for the `GetPage` index [3446fe9b](https://github.com/gohugoio/hugo/commit/3446fe9b8937610b8b628b2c212eb25888a7c1bb) [@bep](https://github.com/bep) [#4312](https://github.com/gohugoio/hugo/issues/4312)
* Simplify bundle lookup via `.Site.GetPage`, `ref`, `relref` [517b6b62](https://github.com/gohugoio/hugo/commit/517b6b62389d23bfe41fe3ae551a691b11bdcaa7) [@bep](https://github.com/bep) [#4312](https://github.com/gohugoio/hugo/issues/4312)
* Remove some now superflous Fast Render Mode code [feeed073](https://github.com/gohugoio/hugo/commit/feeed073c3320b09fb38168ce272ac88b987f1d2) [@bep](https://github.com/bep) [#4339](https://github.com/gohugoio/hugo/issues/4339)
* Make resource counters for `name` and `title` independent [df20b054](https://github.com/gohugoio/hugo/commit/df20b05463fef42aba93d5208e410a7ecc56da5d) [@bep](https://github.com/bep) [#4335](https://github.com/gohugoio/hugo/issues/4335)
* Provide .Name to the archetype templates [863a812e](https://github.com/gohugoio/hugo/commit/863a812e07193541b42732b0e227f3d320433f01) [@bep](https://github.com/bep) [#4348](https://github.com/gohugoio/hugo/issues/4348)
* Only set `url` if permalink in metadata and remove duplicate confirm msg [3752348e](https://github.com/gohugoio/hugo/commit/3752348ef13ced8f6f528b42ee7d76a12a97ae5c) [@lildude](https://github.com/lildude) [#1887](https://github.com/gohugoio/hugo/issues/1887)
* Start Resources :counter first time they're used [7b472e46](https://github.com/gohugoio/hugo/commit/7b472e46084b603045b87cea870ffc73ac1cf7e7) [@bep](https://github.com/bep) [#4335](https://github.com/gohugoio/hugo/issues/4335)
* Update to Go 1.9.3 [a91aba1c](https://github.com/gohugoio/hugo/commit/a91aba1c1562259dffd321a608f38c38dd4d5aeb) [@bep](https://github.com/bep) [#4328](https://github.com/gohugoio/hugo/issues/4328)
* Support pages without front matter [91bb774a](https://github.com/gohugoio/hugo/commit/91bb774ae4e129f7ed0624754b31479c960ef774) [@vassudanagunta](https://github.com/vassudanagunta) [#4320](https://github.com/gohugoio/hugo/issues/4320)[#4320](https://github.com/gohugoio/hugo/issues/4320)
* Add page metadata dates tests [3f0379ad](https://github.com/gohugoio/hugo/commit/3f0379adb72389954ca2be6a9f2ebfcd65c6c440) [@vassudanagunta](https://github.com/vassudanagunta)
* Re-generate CLI docs [1e27d058](https://github.com/gohugoio/hugo/commit/1e27d0589118a114e49c032e4bd68b4798e44a5b) [@bep](https://github.com/bep)
* Remove and update deprecation status [d418c2c2](https://github.com/gohugoio/hugo/commit/d418c2c2eacdc1dc6fffe839e0a90600867878ca) [@bep](https://github.com/bep)
* Shorten the stale setup [4a7c2b36](https://github.com/gohugoio/hugo/commit/4a7c2b3695fe7b88861f2155ea7ef635fe425cd4) [@bep](https://github.com/bep)
* Add a `GetPage` to the site benchmarks [a1956391](https://github.com/gohugoio/hugo/commit/a19563910eec5fed08f3b02563b9a7b38026183d) [@bep](https://github.com/bep)
* Add headless bundle support [0432c64d](https://github.com/gohugoio/hugo/commit/0432c64dd22e4610302162678bb93661ba68d758) [@bep](https://github.com/bep) [#4311](https://github.com/gohugoio/hugo/issues/4311)
* Merge matching resources params maps [5a0819b9](https://github.com/gohugoio/hugo/commit/5a0819b9b5eb9e79826cfa0a65f235d9821b1ac4) [@bep](https://github.com/bep) [#4315](https://github.com/gohugoio/hugo/issues/4315)
* Add some general code contribution criterias [78c86330](https://github.com/gohugoio/hugo/commit/78c863305f337ed4faf3cf0a23675f28b0ae5641) [@bep](https://github.com/bep)
* Tighten page kind logic, introduce tests [8125b4b0](https://github.com/gohugoio/hugo/commit/8125b4b03d10eb73f8aea3f9ea41172aba8df082) [@vassudanagunta](https://github.com/vassudanagunta)
## Fixes
* Fix `robots.txt` in multihost mode [4d912e2a](https://github.com/gohugoio/hugo/commit/4d912e2aad39bfe8d76672cf53b01317792e02c5) [@bep](https://github.com/bep) [#4193](https://github.com/gohugoio/hugo/issues/4193)
* Fix `--uglyURLs` from comand line regression [016398ff](https://github.com/gohugoio/hugo/commit/016398ffe2e0a073453cf46a9d6bf72d693c11e5) [@bep](https://github.com/bep) [#4343](https://github.com/gohugoio/hugo/issues/4343)
* Avoid unescape in `highlight` [ebdd8cba](https://github.com/gohugoio/hugo/commit/ebdd8cba3f5965a8ac897833f313d772271de649) [@bep](https://github.com/bep) [#4219](https://github.com/gohugoio/hugo/issues/4219)
* Fix Docker build [a34213f0](https://github.com/gohugoio/hugo/commit/a34213f0b5624de101272aab469ca9b6fe0c273f) [@skoblenick](https://github.com/skoblenick) [#4076](https://github.com/gohugoio/hugo/issues/4076)[#4077](https://github.com/gohugoio/hugo/issues/4077)
* Fix language params handling [ae742cb1](https://github.com/gohugoio/hugo/commit/ae742cb1bdf35b81aa0ede5453da6b0c4a4fccf2) [@bep](https://github.com/bep) [#4356](https://github.com/gohugoio/hugo/issues/4356)[#4352](https://github.com/gohugoio/hugo/issues/4352)
* Fix handling of top-level page bundles [4eb2fec6](https://github.com/gohugoio/hugo/commit/4eb2fec67c3a72a3ac98aa834dc56fd4504626d8) [@bep](https://github.com/bep) [#4332](https://github.com/gohugoio/hugo/issues/4332)
* Fix `baseURL` server regression for multilingual sites [ed4a00e4](https://github.com/gohugoio/hugo/commit/ed4a00e46f2344320a22f07febe5aec4075cb3fb) [@bep](https://github.com/bep) [#4333](https://github.com/gohugoio/hugo/issues/4333)
* Fix "date" page param [322c5672](https://github.com/gohugoio/hugo/commit/322c567220aa4123a5d707629c1bebd375599912) [@vassudanagunta](https://github.com/vassudanagunta) [#4323](https://github.com/gohugoio/hugo/issues/4323)
* Fix typo in comment [912147ab](https://github.com/gohugoio/hugo/commit/912147ab896e69a450b7100c3d6bf81a7bf78b5a) [@yanzay](https://github.com/yanzay)
+1 -6
View File
@@ -28,12 +28,7 @@ The homepage template is the *only* required template for building a site and th
## Homepage Template Lookup Order
The [lookup order][lookup] for the homepage template is as follows:
1. `/layouts/index.html`
2. `/layouts/_default/list.html`
3. `/themes/<THEME>/layouts/index.html`
4. `/themes/<THEME>/layouts/_default/list.html`
See [Template Lookup](/templates/lookup-order/).
## Add Content and Front Matter to the Homepage
+2
View File
@@ -31,6 +31,8 @@ Hugo uses the term *list* in its truest sense; i.e. a sequential arrangement of
* [Section list pages][sectiontemps]
* [RSS][rss]
For template lookup order, see [Template Lookup](/templates/lookup-order/).
The idea of a list page comes from the [hierarchical mental model of the web][mentalmodel] and is best demonstrated visually:
![Image demonstrating a hierarchical website sitemap.](/images/site-hierarchy.svg)
+58 -157
View File
@@ -1,13 +1,13 @@
---
title: Hugo's Lookup Order
linktitle: Template Lookup Order
description: The lookup order is a prioritized list used by Hugo as it traverses your files looking for the appropriate corresponding file to render your content.
description: Hugo searches for the layout to use for a given page in a well defined order, starting from the most specific.
godocref:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-05-25
categories: [templates,fundamentals]
keywords: [lookup]
keywords: [templates]
menu:
docs:
parent: "templates"
@@ -20,172 +20,73 @@ aliases: [/templates/lookup/]
toc: true
---
Before creating your templates, it's important to know how Hugo looks for files within your project's [directory structure][].
## Hugo Layouts Lookup Rules
Hugo uses a prioritized list called the **lookup order** as it traverses your `layouts` folder in your Hugo project *looking* for the appropriate template to render your content.
Hugo takes the parameters listed below into consideration when choosing a layout for a given page. They are listed in a priority order. This should feel natural, but look at the table below for concrete examples of the different parameter variations.
The template lookup order is an inverted cascade: if template A isnt present or specified, Hugo will look to template B. If template B isn't present or specified, Hugo will look for template C...and so on until it reaches the `_default/` directory for your project or theme. In many ways, the lookup order is similar to the programming concept of a [switch statement without fallthrough][switch].
The power of the lookup order is that it enables you to craft specific layouts and keep your templating [DRY][].
Kind
: The page `Kind` (the home page is one). See the example tables below per kind. This also determines if it is a **single page** (i.e. a regular content page. We then look for a template in `_default/single.html` for HTML) or a **list page** (section listings, home page, taxonomy lists, taxonomy terms. We then look for a template in `_default/list.html` for HTML).
Output Format
: See [Custom Output Formats](/templates/output-formats). An output format has both a `name` (e.g. `rss`, `amp`, `html`) and a `suffix` (e.g. `xml`, `html`). We prefer matches with both (e.g. `index.amp.html`, but look for less specific templates.
Language
: We will consider a language code in the template name. If the site language is `fr`, `index.fr.amp.html` will win over `index.amp.html`, but we will `index.amp.html` will be chosen before `index.fr.html`.
Layout
: Can be set in page front matter.
Type
: Is value of `type` if set in front matter, else it is the name of the root section (e.g. "blog"). If will always have a value, so if not set, the value is "page".
Section
: Is relevant for `section`, `taxonomy` and `taxonomyTerm` types.
{{% note %}}
Most Hugo websites will only need the default template files at the end of the lookup order (i.e. `_default/*.html`).
{{% /note %}}
## Lookup Orders
The respective lookup order for each of Hugo's templates has been defined throughout the Hugo docs:
* [Homepage Template][home]
* [Base Templates][base]
* [Section Page Templates][sectionlookup]
* [Taxonomy List Templates][taxonomylookup]
* [Taxonomy Terms Templates][termslookup]
* [Single Page Templates][singlelookup]
* [RSS Templates][rsslookup]
* [Shortcode Templates][sclookup]
## Template Lookup Examples
The lookup order is best illustrated through examples. The following shows you the process Hugo uses for finding the appropriate template to render your [single page templates][], but the concept holds true for all templates in Hugo.
1. The project is using the theme `mytheme` (specified in the project's [configuration][config]).
2. The layouts and content directories for the project are as follows:
**Tip:** The examples below looks long and complex. That is the flexibility talking. Most Hugo sites contain just a handful of templates:
```bash
├── _default
│   ├── baseof.html
│   ├── list.html
│   └── single.html
└── index.html
```
.
├── content
│ ├── events
│ │ ├── _index.md
│ │ └── my-first-event.md
│ └── posts
│ ├── my-first-post.md
│ └── my-second-post.md
├── layouts
│ ├── _default
│ │ └── single.html
│ ├── posts
│ │ └── single.html
│ └── reviews
│ └── reviewarticle.html
└── themes
└── mytheme
└── layouts
├── _default
│ ├── list.html
│ └── single.html
└── posts
├── list.html
└── single.html
```
Now we can look at the front matter for the three content (i.e.`.md`) files.
{{% note %}}
Only three of the four markdown files in the above project are subject to the *single* page lookup order. `_index.md` is a specific `kind` in Hugo. Whereas `my-first-post.md`, `my-second-post.md`, and `my-first-event.md` are all of kind `page`, all `_index.md` files in a Hugo project are used to add content and front matter to [list pages](/templates/lists/). In this example, `events/_index.md` will render according to its [section template](/templates/section-templates/) and respective lookup order.
{{% /note %}}
### Example: `my-first-post.md`
{{< code file="content/posts/my-first-post.md" copy="false" >}}
---
title: My First Post
date: 2017-02-19
description: This is my first post.
---
{{< /code >}}
## Hugo Layouts Lookup Rules With Theme
In Hugo, layouts can live in either the project's or theme's layout folder, and the most specific layout will be chosen. Hugo will interleave the lookups:
1. layouts/page/index.html
2. demoTheme/layouts/page/index.html
3. layouts/...
This way it is possible to override specific templates from the theme.
## Examples: Layout Lookup for Regular Pages
{{< datatable-filtered "output" "layouts" "Kind == page" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Home Page
{{< datatable-filtered "output" "layouts" "Kind == home" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Section Pages
{{< datatable-filtered "output" "layouts" "Kind == section" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Taxonomy List Pages
{{< datatable-filtered "output" "layouts" "Kind == taxonomy" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Taxonomy Terms Pages
{{< datatable-filtered "output" "layouts" "Kind == taxonomyTerm" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
When building your site, Hugo will go through the lookup order until it finds what it needs for `my-first-post.md`:
1. ~~`/layouts/UNSPECIFIED/UNSPECIFIED.html`~~
2. ~~`/layouts/posts/UNSPECIFIED.html`~~
3. ~~`/layouts/UNSPECIFIED/single.html`~~
4. <span class="yes">`/layouts/posts/single.html`</span>
<br><span class="break">BREAK</span>
5. <span class="na">`/layouts/_default/single.html`</span>
6. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/UNSPECIFIED.html`</span>
7. <span class="na">`/themes/<THEME>/layouts/posts/UNSPECIFIED.html`</span>
8. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/single.html`</span>
9. <span class="na">`/themes/<THEME>/layouts/posts/single.html`</span>
10. <span class="na">`/themes/<THEME>/layouts/_default/single.html`</span>
Notice the term `UNSPECIFIED` rather than `UNDEFINED`. If you don't tell Hugo the specific type and layout, it makes assumptions based on sane defaults. `my-first-post.md` does not specify a content `type` in its front matter. Therefore, Hugo assumes the content `type` and `section` (i.e. `posts`, which is defined by file location) are one in the same. ([Read more on sections][sections].)
`my-first-post.md` also does not specify a `layout` in its front matter. Therefore, Hugo assumes that `my-first-post.md`, which is of type `page` and a *single* piece of content, should default to the next occurrence of a `single.html` template in the lookup (#4).
### Example: `my-second-post.md`
{{< code file="content/posts/my-second-post.md" copy="false" >}}
---
title: My Second Post
date: 2017-02-21
description: This is my second post.
type: review
layout: reviewarticle
---
{{< /code >}}
Here is the way Hugo traverses the single-page lookup order for `my-second-post.md`:
1. <span class="yes">`/layouts/review/reviewarticle.html`</span>
<br><span class="break">BREAK</span>
2. <span class="na">`/layouts/posts/reviewarticle.html`</span>
3. <span class="na">`/layouts/review/single.html`</span>
4. <span class="na">`/layouts/posts/single.html`</span>
5. <span class="na">`/layouts/_default/single.html`</span>
6. <span class="na">`/themes/<THEME>/layouts/review/reviewarticle.html`</span>
7. <span class="na">`/themes/<THEME>/layouts/posts/reviewarticle.html`</span>
8. <span class="na">`/themes/<THEME>/layouts/review/single.html`</span>
9. <span class="na">`/themes/<THEME>/layouts/posts/single.html`</span>
10. <span class="na">`/themes/<THEME>/layouts/_default/single.html`</span>
The front matter in `my-second-post.md` specifies the content `type` (i.e. `review`) as well as the `layout` (i.e. `reviewarticle`). Hugo finds the layout it needs at the top level of the lookup (#1) and does not continue to search through the other templates.
{{% note "Type and not Types" %}}
Notice that the directory for the template for `my-second-post.md` is `review` and not `reviews`. This is because *type is always singular when defined in front matter*.
{{% /note%}}
### Example: `my-first-event.md`
{{< code file="content/events/my-first-event.md" copy="false" >}}
---
title: My First
date: 2017-02-21
description: This is an upcoming event..
---
{{< /code >}}
Here is the way Hugo traverses the single-page lookup order for `my-first-event.md`:
1. ~~`/layouts/UNSPECIFIED/UNSPECIFIED.html`~~
2. ~~`/layouts/events/UNSPECIFIED.html`~~
3. ~~`/layouts/UNSPECIFIED/single.html`~~
4. ~~`/layouts/events/single.html`~~
5. <span class="yes">`/layouts/_default/single.html`</span>
<br><span class="break">BREAK</span>
6. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/UNSPECIFIED.html`</span>
7. <span class="na">`/themes/<THEME>/layouts/events/UNSPECIFIED.html`</span>
8. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/single.html`</span>
9. <span class="na">`/themes/<THEME>/layouts/events/single.html`</span>
10. <span class="na">`/themes/<THEME>/layouts/_default/single.html`</span>
{{% note %}}
`my-first-event.md` is significant because it demonstrates the role of the lookup order in Hugo themes. Both the root project directory *and* the `mytheme` themes directory have a file at `_default/single.html`. Understanding this order allows you to [customize Hugo themes](/themes/customizing/) by creating template files with identical names in your project directory that step in front of theme template files in the lookup. This allows you to customize the look and feel of your website while maintaining compatibility with the theme's upstream.
{{% /note %}}
[base]: /templates/base/#base-template-lookup-order
[config]: /getting-started/configuration/
[directory structure]: /getting-started/directory-structure/
[DRY]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
[home]: /templates/homepage/#homepage-template-lookup-order
[rsslookup]: /templates/rss/#rss-template-lookup-order
[sclookup]: /templates/shortcode-templates/#shortcode-template-lookup-order
[sections]: /content-management/sections/
[sectionlookup]: /templates/section-templates/#section-template-lookup-order
[single page templates]: /templates/single-page-templates/
[singlelookup]: /templates/single-page-templates/#single-page-template-lookup-order
[switch]: https://en.wikipedia.org/wiki/Switch_statement#Fallthrough
[taxonomylookup]: /templates/taxonomy-templates/#taxonomy-list-template-lookup-order
[termslookup]: /templates/taxonomy-templates/#taxonomy-terms-template-lookup-order
+87 -35
View File
@@ -9,6 +9,7 @@ categories: [templates]
keywords: [lists,sections,menus]
menu:
docs:
title: "how to use menus in templates"
parent: "templates"
weight: 130
weight: 130
@@ -27,40 +28,35 @@ The following is an example:
{{< code file="layouts/partials/sidebar.html" download="sidebar.html" >}}
<!-- sidebar start -->
<aside>
<div id="sidebar" class="nav-collapse">
<!-- sidebar menu start-->
<ul class="sidebar-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="sub-menu{{if $currentPage.HasMenuCurrent "main" . }} active{{end}}">
<a href="javascript:;" class="">
{{ .Pre }}
<span>{{ .Name }}</span>
<span class="menu-arrow arrow_carrot-right"></span>
</a>
<ul class="sub">
{{ range .Children }}
<li{{if $currentPage.IsMenuCurrent "main" . }} class="active"{{end}}><a href="{{.URL}}"> {{ .Name }} </a> </li>
{{ end }}
</ul>
{{else}}
<li>
<a href="{{.URL}}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
{{end}}
</li>
{{end}}
<li> <a href="https://github.com/gohugoio/hugo/issues" target="blank">Questions and Issues</a> </li>
<li> <a href="#" target="blank">Edit this Page</a> </li>
</ul>
<!-- sidebar menu end-->
</div>
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</ul>
{{else}}
<li>
<a href="{{.URL}}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
{{end}}
{{end}}
<li>
<a href="#" target="blank">Hardcoded Link 1</a>
<li>
<a href="#" target="blank">Hardcoded Link 2</a>
</ul>
</aside>
<!--sidebar end-->
{{< /code >}}
{{% note "`absLangURL` and `relLangURL`" %}}
@@ -83,18 +79,22 @@ This will create a menu with all the sections as menu items and all the sections
<nav class="sidebar-nav">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{.URL}}">{{ .Name }}</a>
<a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
</nav>
```
In the above, the menu item is marked as active if on the current section's list page or on a page in that section.
The above is all that's needed. But if you want custom menu items, e.g. changing weight or name, you can define them manually in the site config, i.e. `config.toml`:
## Site Config menus
The above is all that's needed. But if you want custom menu items, e.g. changing weight, name, or link title attribute, you can define them manually in the site config, i.e. `config.toml`:
```
[[menu.main]]
name = "This is the blog section"
title = "blog section"
weight = -110
identifier = "blog"
url = "/blog/"
@@ -103,3 +103,55 @@ The above is all that's needed. But if you want custom menu items, e.g. changing
{{% note %}}
The `identifier` *must* match the section name.
{{% /note %}}
## Menu Entries from the Page's front matter
It's also possible to create menu entries from the page (i.e. the `.md`-file).
Here is a `yaml` example:
```
---
title: Menu Templates
linktitle: Menu Templates
menu:
docs:
title: "how to use menus in templates"
parent: "templates"
weight: 130
---
...
```
{{% note %}}
You can define more than one menu. It also doesn't have to be a complex value,
`menu` can also be a string, an array of strings, or an array of complex values
like in the example above.
{{% /note %}}
### Using .Page in Menus
If you use the front matter method of defining menu entries, you'll get access to the `.Page` variable.
This allows to use every variable that's reachable from the [page variable](/variables/page/).
This variable is only set when the menu entry is defined in the page's front matter.
Menu entries from the site config don't know anything about `.Page`.
That's why you have to use the go template's `with` keyword or something similar in your templating language.
Here's an example:
```
<nav class="sidebar-nav">
{{ range .Site.Menus.main }}
<a href="{{ .URL }}" title="{{ .Title }}">
{{- .Name -}}
{{- with .Page -}}
<span class="date">
{{- dateFormat " (2006-01-02)" .Date -}}
</span>
{{- end -}}
</a>
{{ end }}
</nav>
```
+2 -7
View File
@@ -5,7 +5,7 @@ description: Hugo ships with its own RSS 2.0 template that requires almost no co
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
keywords: [rss, xml]
keywords: [rss, xml, templates]
categories: [templates]
menu:
docs:
@@ -20,12 +20,7 @@ toc: true
## RSS Template Lookup Order
You can use a single RSS template to generate all of your RSS feeds or create a specific template for each individual feed.
1. `/layouts/section/<section>.rss.xml`
2. `/layouts/_default/rss.xml`
3. `/themes/<theme>/layouts/section/<section>.rss.xml`
4. `/themes/<theme>/layouts/_default/rss.xml`
See [Template Lookup](/templates/lookup-order/).
{{% note "Hugo Ships with an RSS Template" %}}
Hugo ships with its own [RSS 2.0 template](#the-embedded-rss-xml). The embedded template will be sufficient for most use cases.
+2 -13
View File
@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [lists,sections]
keywords: [lists,sections,templates]
menu:
docs:
parent: "templates"
@@ -24,18 +24,7 @@ To effectively leverage section page templates, you should first understand Hugo
## Section Template Lookup Order
The [lookup order][lookup] for section templates is as follows:
1. `/layouts/section/<SECTION>.html`
2. `/layouts/<SECTION>/list.html`
3. `/layouts/_default/section.html`
4. `/layouts/_default/list.html`
5. `/themes/<THEME>/layouts/section/<SECTION>.html`
6. `/themes/<THEME>/layouts/<SECTION>/list.html`
7. `/themes/<THEME>/layouts/_default/section.html`
8. `/themes/<THEME>/layouts/_default/list.html`
{{< youtube jrMClsB3VsY >}}
See [Template Lookup](/templates/lookup-order/).
## `.Site.GetPage` with Sections
@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [shortcodes]
keywords: [shortcodes,templates]
menu:
docs:
parent: "templates"
@@ -137,6 +137,10 @@ You can also use the variable `.Page` to access all the normal [page variables][
A shortcodes can also be nested. In a nested shortcode, you can access the parent shortcode context with [`.Parent` variable][shortcodesvars]. This can be very useful for inheritance of common shortcode parameters from the root.
### Checking for Existence
You can check if a specific shortcode is used on a page by calling `.HasShortcode` in that page template, providing the name of the shortcode. This is sometimes useful when you want to include specific scripts or styles in the header that are only used by that shortcode.
## Custom Shortcode Examples
The following are examples of the different types of shortcodes you can create via shortcode template files in `/layouts/shortcodes`.
@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-04-06
categories: [templates]
keywords: [page]
keywords: [page,templates]
menu:
docs:
parent: "templates"
@@ -20,22 +20,7 @@ toc: true
## Single Page Template Lookup Order
You can specify a [content's `type`][content type] and `layout` in a single content file's [front matter][]. However, you cannot specify `section` because this is determined based on file location (see [content section][section]).
Hugo assumes your content section and content type are the same unless you tell Hugo otherwise by providing a `type` directly in the front matter of a content file. This is why #1 and #3 come before #2 and #4, respectively, in the following lookup order. Values in angle brackets (`<>`) are variable.
1. `/layouts/<TYPE>/<LAYOUT>.html`
2. `/layouts/<SECTION>/<LAYOUT>.html`
3. `/layouts/<TYPE>/single.html`
4. `/layouts/<SECTION>/single.html`
5. `/layouts/_default/single.html`
6. `/themes/<THEME>/layouts/<TYPE>/<LAYOUT>.html`
7. `/themes/<THEME>/layouts/<SECTION>/<LAYOUT>.html`
8. `/themes/<THEME>/layouts/<TYPE>/single.html`
9. `/themes/<THEME>/layouts/<SECTION>/single.html`
10. `/themes/<THEME>/layouts/_default/single.html`
{{< youtube ZYQ5k0RQzmo >}}
See [Template Lookup](/templates/lookup-order/).
## Example Single Page Templates
+1 -1
View File
@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [sitemap, xml]
keywords: [sitemap, xml, templates]
menu:
docs:
parent: "templates"
+3 -22
View File
@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [taxonomies,metadata,front matter,terms]
keywords: [taxonomies,metadata,front matter,terms,templates]
menu:
docs:
parent: "templates"
@@ -35,32 +35,13 @@ Taxonomy list page templates are lists and therefore have all the variables and
### Taxonomy List Template Lookup Order
A taxonomy will be rendered at /`PLURAL`/`TERM`/ (e.g., http://spf13.com/topics/golang/) according to the following lookup order:
1. `/layouts/taxonomy/<SINGULAR>.html`
2. `/layouts/_default/taxonomy.html`
3. `/layouts/_default/list.html`
4. `/themes/<THEME>/layouts/taxonomy/<SINGULAR>.html`
5. `/themes/<THEME>/layouts/_default/taxonomy.html`
6. `/themes/<THEME>/layouts/_default/list.html`
See [Template Lookup](/templates/lookup-order/).
## Taxonomy Terms Template
### Taxonomy Terms Templates Lookup Order
A taxonomy terms page will be rendered at `example.com/<PLURALTAXONOMYNAME>`/ (e.g., http://spf13.com/topics/) according to the following lookup order:
1. `/layouts/taxonomy/<SINGULAR>.terms.html`
2. `/layouts/_default/terms.html`
3. `/themes/<THEME>/layouts/taxonomy/<SINGULAR>.terms.html`
4. `/themes/<THEME>/layouts/_default/terms.html`
{{% warning "The Taxonomy Terms Template has a Unique Lookup Order" %}}
If Hugo does not find a terms template in `layout/` or `/themes/<THEME>/layouts/`, Hugo will *not* render a taxonomy terms page.
{{% /warning %}}
<!-- Begin /taxonomies/methods/ -->
Hugo makes a set of values and methods available on the various Taxonomy structures.
See [Template Lookup](/templates/lookup-order/).
### Taxonomy Methods
+1 -1
View File
@@ -30,7 +30,7 @@ The Hugo community uses a wide range of preferred tools and has developed plug-i
## Emacs
* [hugo.el](https://github.com/yewton/hugo.el). Some helper functions for creating a Website with Hugo. Note that Hugo also supports [Org-mode][formats].
* [emacs-easy-hugo](https://github.com/masasam/emacs-easy-hugo). Emacs major mode for managing hugo blogs. Note that Hugo also supports [Org-mode][formats].
* [ox-hugo.el](https://ox-hugo.scripter.co). Native Org-mode exporter that exports to Blackfriday Markdown with Hugo front-matter. `ox-hugo` supports two common Org blogging flows --- exporting multiple Org sub-trees in a single file to multiple Hugo posts, and exporting a single Org file to a single Hugo post. It also leverages the Org tag and property inheritance features. See [*Why ox-hugo?*](https://ox-hugo.scripter.co/doc/why-ox-hugo/) for more.
## Vim
+1
View File
@@ -65,6 +65,7 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import
## Blogger
- [blogimport](https://github.com/natefinch/blogimport) - A tool to import from Blogger posts to Hugo.
- [blogger-to-hugo](https://bitbucket.org/petraszd/blogger-to-hugo) - Another tool to import Blogger posts to Hugo. It also downloads embedded images so they will be stored locally.
## Contentful
+2 -1
View File
@@ -23,7 +23,8 @@ A static website with a dynamic search function? Yes. As alternatives to embedda
* [Hugoidx](https://github.com/blevesearch/hugoidx) is an experimental application to create a search index. It's built on top of [Bleve](http://www.blevesearch.com/).
* [GitHub Gist for Hugo Workflow](https://gist.github.com/sebz/efddfc8fdcb6b480f567). This gist contains a simple workflow to create a search index for your static website. It uses a simple Grunt script to index all your content files and [lunr.js](http://lunrjs.com/) to serve the search results.
* [hugo-lunr](https://www.npmjs.com/package/hugo-lunr). A simple way to add site search to your static Hugo site using [lunr.js](http://lunrjs.com/). Hugo-lunr will create an index file of any html and markdown documents in your Hugo project.
* [hugo-lunr-zh](https://www.npmjs.com/package/hugo-lunr-zh). A bit like Hugo-lunr, but Hugo-lunr-zh can help you seperate the Chinese keywords.
## Commercial Search Services
* [Algolia](https://www.algolia.com/)'s Search API makes it easy to deliver a great search experience in your apps and websites. Algolia Search provides hosted full-text, numerical, faceted, and geolocalized search.
* [Algolia](https://www.algolia.com/)'s Search API makes it easy to deliver a great search experience in your apps and websites. Algolia Search provides hosted full-text, numerical, faceted, and geolocalized search.
+18 -1
View File
@@ -10,6 +10,7 @@ keywords: [menus]
draft: false
menu:
docs:
title: "variables defined by a menu entry"
parent: "variables"
weight: 50
weight: 50
@@ -26,6 +27,22 @@ The [menu template][] has the following properties:
.Name
: string
.Title
: string
This is a link title, meant to be used in `title`-Attributes of the menu's `<a>`-tags.
By default it returns `.Page.LinkTitle`, as long as the menu entry was created
through the page's front matter and not through the site config.
Setting it explicitly in the site config or the page's front matter overrides this behaviour.
.Page
: [Page Object](/variables/page/)
The `.Page` variable holds a reference to the page.
It's only set when the menu entry is created from the page's front matter,
not when it's created from the site config.
.Menu
: string
@@ -47,4 +64,4 @@ The [menu template][] has the following properties:
.Children
: Menu
[menu template]: /templates/menu-templates/
[menu template]: /templates/menu-templates/
+2 -1
View File
@@ -10,6 +10,7 @@ keywords: [pages]
draft: false
menu:
docs:
title: "variables defined by a page"
parent: "variables"
weight: 20
weight: 20
@@ -191,7 +192,7 @@ Any other value defined in the front matter in a content file, including taxonom
```
---
title: My First Post
date: date: 2017-02-20T15:26:23-06:00
date: 2017-02-20T15:26:23-06:00
categories: [one]
tags: [two,three,four]
```
+427 -101
View File
@@ -220,131 +220,457 @@
],
"layouts": [
{
"Example": "AMP home, with theme \"demoTheme\".",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/index.amp.html",
"layouts/index.html",
"layouts/_default/list.amp.html",
"layouts/_default/list.html",
"demoTheme/layouts/index.amp.html",
"demoTheme/layouts/index.html",
"demoTheme/layouts/_default/list.amp.html",
"demoTheme/layouts/_default/list.html"
]
},
{
"Example": "AMP home, French language\".",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/index.fr.amp.html",
"layouts/index.amp.html",
"layouts/index.fr.html",
"layouts/index.html",
"layouts/_default/list.fr.amp.html",
"layouts/_default/list.amp.html",
"layouts/_default/list.fr.html",
"layouts/_default/list.html"
]
},
{
"Example": "RSS home, no theme.",
"OutputFormat": "RSS",
"Suffix": "xml",
"Template Lookup Order": [
"layouts/rss.xml",
"layouts/_default/rss.xml",
"layouts/_internal/_default/rss.xml"
]
},
{
"Example": "JSON home, no theme.",
"OutputFormat": "JSON",
"Suffix": "json",
"Template Lookup Order": [
"layouts/index.json.json",
"layouts/index.json",
"layouts/_default/list.json.json",
"layouts/_default/list.json"
]
},
{
"Example": "CSV regular, \"layout: demolayout\" in front matter.",
"OutputFormat": "CSV",
"Suffix": "csv",
"Template Lookup Order": [
"layouts/_default/demolayout.csv.csv",
"layouts/_default/demolayout.csv"
]
},
{
"Example": "JSON regular, \"type: demotype\" in front matter.",
"OutputFormat": "JSON",
"Suffix": "json",
"Template Lookup Order": [
"layouts/demotype/single.json.json",
"layouts/demotype/single.json",
"layouts/_default/single.json.json",
"layouts/_default/single.json"
]
},
{
"Example": "HTML regular.",
"Example": "Single page in \"posts\" section",
"Kind": "page",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/single.html.html",
"layouts/posts/single.html",
"layouts/_default/single.html.html",
"layouts/_default/single.html"
]
},
{
"Example": "AMP regular.",
"Example": "Single page in \"posts\" section with layout set",
"Kind": "page",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/demolayout.html.html",
"layouts/posts/single.html.html",
"layouts/posts/demolayout.html",
"layouts/posts/single.html",
"layouts/_default/demolayout.html.html",
"layouts/_default/single.html.html",
"layouts/_default/demolayout.html",
"layouts/_default/single.html"
]
},
{
"Example": "Single page in \"posts\" section with theme",
"Kind": "page",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/single.html.html",
"demoTheme/layouts/posts/single.html.html",
"layouts/posts/single.html",
"demoTheme/layouts/posts/single.html",
"layouts/_default/single.html.html",
"demoTheme/layouts/_default/single.html.html",
"layouts/_default/single.html",
"demoTheme/layouts/_default/single.html"
]
},
{
"Example": "AMP single page",
"Kind": "page",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/single.amp.html",
"layouts/posts/single.html",
"layouts/_default/single.amp.html",
"layouts/_default/single.html"
]
},
{
"Example": "Calendar blog section.",
"OutputFormat": "Calendar",
"Suffix": "ics",
"Example": "AMP single page, French language",
"Kind": "page",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/section/blog.calendar.ics",
"layouts/section/blog.ics",
"layouts/blog/list.calendar.ics",
"layouts/blog/list.ics",
"layouts/_default/section.calendar.ics",
"layouts/_default/section.ics",
"layouts/_default/list.calendar.ics",
"layouts/_default/list.ics"
"layouts/posts/single.fr.amp.html",
"layouts/posts/single.amp.html",
"layouts/posts/single.fr.html",
"layouts/posts/single.html",
"layouts/_default/single.fr.amp.html",
"layouts/_default/single.amp.html",
"layouts/_default/single.fr.html",
"layouts/_default/single.html"
]
},
{
"Example": "Calendar taxonomy list.",
"OutputFormat": "Calendar",
"Suffix": "ics",
"Example": "Home page",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/taxonomy/tag.calendar.ics",
"layouts/taxonomy/tag.ics",
"layouts/_default/taxonomy.calendar.ics",
"layouts/_default/taxonomy.ics",
"layouts/_default/list.calendar.ics",
"layouts/_default/list.ics"
"layouts/page/index.html.html",
"layouts/page/home.html.html",
"layouts/page/list.html.html",
"layouts/page/index.html",
"layouts/page/home.html",
"layouts/page/list.html",
"layouts/index.html.html",
"layouts/home.html.html",
"layouts/list.html.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "Calendar taxonomy term.",
"OutputFormat": "Calendar",
"Suffix": "ics",
"Example": "Home page with type set",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/taxonomy/tag.terms.calendar.ics",
"layouts/taxonomy/tag.terms.ics",
"layouts/_default/terms.calendar.ics",
"layouts/_default/terms.ics"
"layouts/demotype/index.html.html",
"layouts/demotype/home.html.html",
"layouts/demotype/list.html.html",
"layouts/demotype/index.html",
"layouts/demotype/home.html",
"layouts/demotype/list.html",
"layouts/index.html.html",
"layouts/home.html.html",
"layouts/list.html.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "Home page with layout set",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/page/demolayout.html.html",
"layouts/page/index.html.html",
"layouts/page/home.html.html",
"layouts/page/list.html.html",
"layouts/page/demolayout.html",
"layouts/page/index.html",
"layouts/page/home.html",
"layouts/page/list.html",
"layouts/demolayout.html.html",
"layouts/index.html.html",
"layouts/home.html.html",
"layouts/list.html.html",
"layouts/demolayout.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/demolayout.html.html",
"layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"layouts/_default/demolayout.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "Home page with theme",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/page/index.html.html",
"demoTheme/layouts/page/index.html.html",
"layouts/page/home.html.html",
"demoTheme/layouts/page/home.html.html",
"layouts/page/list.html.html",
"demoTheme/layouts/page/list.html.html",
"layouts/page/index.html",
"demoTheme/layouts/page/index.html",
"layouts/page/home.html",
"demoTheme/layouts/page/home.html",
"layouts/page/list.html",
"demoTheme/layouts/page/list.html",
"layouts/index.html.html",
"demoTheme/layouts/index.html.html",
"layouts/home.html.html",
"demoTheme/layouts/home.html.html",
"layouts/list.html.html",
"demoTheme/layouts/list.html.html",
"layouts/index.html",
"demoTheme/layouts/index.html",
"layouts/home.html",
"demoTheme/layouts/home.html",
"layouts/list.html",
"demoTheme/layouts/list.html",
"layouts/_default/index.html.html",
"demoTheme/layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"demoTheme/layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"demoTheme/layouts/_default/list.html.html",
"layouts/_default/index.html",
"demoTheme/layouts/_default/index.html",
"layouts/_default/home.html",
"demoTheme/layouts/_default/home.html",
"layouts/_default/list.html",
"demoTheme/layouts/_default/list.html"
]
},
{
"Example": "AMP home, French language\"",
"Kind": "home",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/page/index.fr.amp.html",
"layouts/page/home.fr.amp.html",
"layouts/page/list.fr.amp.html",
"layouts/page/index.amp.html",
"layouts/page/home.amp.html",
"layouts/page/list.amp.html",
"layouts/page/index.fr.html",
"layouts/page/home.fr.html",
"layouts/page/list.fr.html",
"layouts/page/index.html",
"layouts/page/home.html",
"layouts/page/list.html",
"layouts/index.fr.amp.html",
"layouts/home.fr.amp.html",
"layouts/list.fr.amp.html",
"layouts/index.amp.html",
"layouts/home.amp.html",
"layouts/list.amp.html",
"layouts/index.fr.html",
"layouts/home.fr.html",
"layouts/list.fr.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/index.fr.amp.html",
"layouts/_default/home.fr.amp.html",
"layouts/_default/list.fr.amp.html",
"layouts/_default/index.amp.html",
"layouts/_default/home.amp.html",
"layouts/_default/list.amp.html",
"layouts/_default/index.fr.html",
"layouts/_default/home.fr.html",
"layouts/_default/list.fr.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "JSON home",
"Kind": "home",
"OutputFormat": "JSON",
"Suffix": "json",
"Template Lookup Order": [
"layouts/page/index.json.json",
"layouts/page/home.json.json",
"layouts/page/list.json.json",
"layouts/page/index.json",
"layouts/page/home.json",
"layouts/page/list.json",
"layouts/index.json.json",
"layouts/home.json.json",
"layouts/list.json.json",
"layouts/index.json",
"layouts/home.json",
"layouts/list.json",
"layouts/_default/index.json.json",
"layouts/_default/home.json.json",
"layouts/_default/list.json.json",
"layouts/_default/index.json",
"layouts/_default/home.json",
"layouts/_default/list.json"
]
},
{
"Example": "RSS home",
"Kind": "home",
"OutputFormat": "RSS",
"Suffix": "xml",
"Template Lookup Order": [
"layouts/page/index.rss.xml",
"layouts/page/home.rss.xml",
"layouts/page/rss.xml",
"layouts/page/list.rss.xml",
"layouts/page/index.xml",
"layouts/page/home.xml",
"layouts/page/list.xml",
"layouts/index.rss.xml",
"layouts/home.rss.xml",
"layouts/rss.xml",
"layouts/list.rss.xml",
"layouts/index.xml",
"layouts/home.xml",
"layouts/list.xml",
"layouts/_default/index.rss.xml",
"layouts/_default/home.rss.xml",
"layouts/_default/rss.xml",
"layouts/_default/list.rss.xml",
"layouts/_default/index.xml",
"layouts/_default/home.xml",
"layouts/_default/list.xml",
"layouts/_internal/_default/rss.xml"
]
},
{
"Example": "Section list for \"posts\" section",
"Kind": "section",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/posts.html.html",
"layouts/posts/section.html.html",
"layouts/posts/list.html.html",
"layouts/posts/posts.html",
"layouts/posts/section.html",
"layouts/posts/list.html",
"layouts/section/posts.html.html",
"layouts/section/section.html.html",
"layouts/section/list.html.html",
"layouts/section/posts.html",
"layouts/section/section.html",
"layouts/section/list.html",
"layouts/_default/posts.html.html",
"layouts/_default/section.html.html",
"layouts/_default/list.html.html",
"layouts/_default/posts.html",
"layouts/_default/section.html",
"layouts/_default/list.html"
]
},
{
"Example": "Section list for \"posts\" section with type set to \"blog\"",
"Kind": "section",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/blog/posts.html.html",
"layouts/blog/section.html.html",
"layouts/blog/list.html.html",
"layouts/blog/posts.html",
"layouts/blog/section.html",
"layouts/blog/list.html",
"layouts/posts/posts.html.html",
"layouts/posts/section.html.html",
"layouts/posts/list.html.html",
"layouts/posts/posts.html",
"layouts/posts/section.html",
"layouts/posts/list.html",
"layouts/section/posts.html.html",
"layouts/section/section.html.html",
"layouts/section/list.html.html",
"layouts/section/posts.html",
"layouts/section/section.html",
"layouts/section/list.html",
"layouts/_default/posts.html.html",
"layouts/_default/section.html.html",
"layouts/_default/list.html.html",
"layouts/_default/posts.html",
"layouts/_default/section.html",
"layouts/_default/list.html"
]
},
{
"Example": "Section list for \"posts\" section with layout set to \"demoLayout\"",
"Kind": "section",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/demolayout.html.html",
"layouts/posts/posts.html.html",
"layouts/posts/section.html.html",
"layouts/posts/list.html.html",
"layouts/posts/demolayout.html",
"layouts/posts/posts.html",
"layouts/posts/section.html",
"layouts/posts/list.html",
"layouts/section/demolayout.html.html",
"layouts/section/posts.html.html",
"layouts/section/section.html.html",
"layouts/section/list.html.html",
"layouts/section/demolayout.html",
"layouts/section/posts.html",
"layouts/section/section.html",
"layouts/section/list.html",
"layouts/_default/demolayout.html.html",
"layouts/_default/posts.html.html",
"layouts/_default/section.html.html",
"layouts/_default/list.html.html",
"layouts/_default/demolayout.html",
"layouts/_default/posts.html",
"layouts/_default/section.html",
"layouts/_default/list.html"
]
},
{
"Example": "Taxonomy list in categories",
"Kind": "taxonomy",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/categories/category.html.html",
"layouts/categories/taxonomy.html.html",
"layouts/categories/list.html.html",
"layouts/categories/category.html",
"layouts/categories/taxonomy.html",
"layouts/categories/list.html",
"layouts/taxonomy/category.html.html",
"layouts/taxonomy/taxonomy.html.html",
"layouts/taxonomy/list.html.html",
"layouts/taxonomy/category.html",
"layouts/taxonomy/taxonomy.html",
"layouts/taxonomy/list.html",
"layouts/category/category.html.html",
"layouts/category/taxonomy.html.html",
"layouts/category/list.html.html",
"layouts/category/category.html",
"layouts/category/taxonomy.html",
"layouts/category/list.html",
"layouts/_default/category.html.html",
"layouts/_default/taxonomy.html.html",
"layouts/_default/list.html.html",
"layouts/_default/category.html",
"layouts/_default/taxonomy.html",
"layouts/_default/list.html"
]
},
{
"Example": "Taxonomy term in categories",
"Kind": "taxonomyTerm",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/categories/category.terms.html.html",
"layouts/categories/terms.html.html",
"layouts/categories/list.html.html",
"layouts/categories/category.terms.html",
"layouts/categories/terms.html",
"layouts/categories/list.html",
"layouts/taxonomy/category.terms.html.html",
"layouts/taxonomy/terms.html.html",
"layouts/taxonomy/list.html.html",
"layouts/taxonomy/category.terms.html",
"layouts/taxonomy/terms.html",
"layouts/taxonomy/list.html",
"layouts/category/category.terms.html.html",
"layouts/category/terms.html.html",
"layouts/category/list.html.html",
"layouts/category/category.terms.html",
"layouts/category/terms.html",
"layouts/category/list.html",
"layouts/_default/category.terms.html.html",
"layouts/_default/terms.html.html",
"layouts/_default/list.html.html",
"layouts/_default/category.terms.html",
"layouts/_default/terms.html",
"layouts/_default/list.html"
]
}
]
@@ -1427,7 +1753,7 @@
],
"Examples": [
[
"{{chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" }}",
"{{chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" | safeHTML }}",
"\u003cp\u003eBlockhead\u003c/p\u003e"
]
]
+14
View File
@@ -1,3 +1,17 @@
[[tweet]]
name = "Jens Munch"
twitter_handle = "@jensamunch"
quote = "Hugo is really, really incredible... Now does resizing/resampling of images as well! Crazy that something so fast can be a static site generator... Amazing open-source project."
link = "https://twitter.com/jensamunch/status/948533063537086464"
date = 2018-01-03T04:00:00Z
[[tweet]]
name = "carriecoxwell"
twitter_handle = "@carriecoxwell"
quote = "Having a lot of fun with <a href='https://twitter.com/gohugoio' target='_blank'>@GoHugoIO</a>! It's exactly what I didn't even know I wanted."
link = "https://twitter.com/carriecoxwell/status/948402470144872448"
date = 2018-01-03T03:00:00Z
[[tweet]]
name = "STOQE"
twitter_handle = "@STOQE"

Some files were not shown because too many files have changed in this diff Show More