mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
Squashed 'docs/' changes from 710856e5a..6ebb5dad9
6ebb5dad9 Remove file 27cc23ef4 Hugo 0.84.4 94dccbfa4 Merge branch 'tempv0.84.4' e9d8b61fb releaser: Add release notes to /docs for release of 0.84.4 51e472005 Improve readability of examples on shortcode templates page 0aef26479 Fix lookup order typos (#1484) 534a527fe Fix two typos (#1483) 394aabd5a Higo "0.84.3 03ee92c1c Merge branch 'tempv0.84.3' 96a8be0f1 releaser: Add release notes to /docs for release of 0.84.3 9a770323f Update index.md 7f65cfcbe Hugo 0.84.2 444422515 releaser: Add release notes to /docs for release of 0.84.2 a2f29c5d8 modules: Add module.import.noMounts config e00e4a7e7 releaser: Add release notes to /docs for release of 0.84.2 af04b53b3 modules: Add module.import.noMounts config f7d5669c7 Remove Appernetic (#1481) 14f8d4029 Clarify interaction of sections and top-level leaf bundles d140b6a62 Update lookup-order.md 399904959 Update shortcode-templates.md e78aa4865 Hugo 0.84.1 35d7c1c22 Merge branch 'tempv0.84.1' a6be65b0d releaser: Add release notes to /docs for release of 0.84.1 7b3b3ca45 Hugo 0.84.0 News Grammar fixes cbc23bf5a Remove trailing newlines 69349198d Fix erroridf docs dbc1157c1 Fix missing deep git-subtree-dir: docs git-subtree-split: 6ebb5dad9a87655196c0990d88d50a2248df5c54
This commit is contained in:
parent
4dd90050f1
commit
7eb0e10a80
14 changed files with 134 additions and 41 deletions
|
@ -319,8 +319,6 @@ disableDate = false
|
|||
# Hugo extracts the "photo taken where" (GPS latitude and longitude) into
|
||||
# .Long and .Lat. Set this to true to turn it off.
|
||||
disableLatLong = false
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Smart Cropping of Images
|
||||
|
|
|
@ -21,7 +21,9 @@ A **Section** is a collection of pages that gets defined based on the
|
|||
organization structure under the `content/` directory.
|
||||
|
||||
By default, all the **first-level** directories under `content/` form their own
|
||||
sections (**root sections**).
|
||||
sections (**root sections**) provided they constitute [Branch Bundles][branch bundles].
|
||||
Directories which are just [Leaf Bundles][leaf bundles] do *not* form
|
||||
their own sections, despite being first-level directories.
|
||||
|
||||
If a user needs to define a section `foo` at a deeper level, they need to create
|
||||
a directory named `foo` with an `_index.md` file (see [Branch Bundles][branch bundles]
|
||||
|
@ -95,4 +97,5 @@ By default, everything created within a section will use the [content `type`][co
|
|||
[content type]: /content-management/types/
|
||||
[directory structure]: /getting-started/directory-structure/
|
||||
[section templates]: /templates/section-templates/
|
||||
[leaf bundles]: /content-management/page-bundles/#leaf-bundles
|
||||
[branch bundles]: /content-management/page-bundles/#branch-bundles
|
||||
|
|
|
@ -30,17 +30,16 @@ Both functions return an empty string, so the messages are only printed to the c
|
|||
{{ warnf "You should update the shortcodes in %q" .Path }}
|
||||
```
|
||||
|
||||
Note that `errorf` and `warnf` support all the formatting verbs of the [fmt](https://golang.org/pkg/fmt/) package.
|
||||
Note that `errorf`, `erroridf`, and `warnf` support all the formatting verbs of the [fmt](https://golang.org/pkg/fmt/) package.
|
||||
|
||||
## Suppress errors
|
||||
|
||||
Some times it may make sense to let the user suppress an ERROR and make the build succeed.
|
||||
Sometimes it may make sense to let the user suppress an ERROR and make the build succeed.
|
||||
|
||||
You can do this by using the `erroridf` function. This functions takes an error ID as the first arument.
|
||||
You can do this by using the `erroridf` function. This functions takes an error ID as the first argument.
|
||||
|
||||
|
||||
``
|
||||
{{ erroridf "my-custom-error" "You should consider fixing this."}}
|
||||
```
|
||||
{{ erroridf "my-custom-error" "You should consider fixing this." }}
|
||||
```
|
||||
|
||||
This will produce:
|
||||
|
|
|
@ -93,7 +93,7 @@ none
|
|||
shallow
|
||||
: Only add values for new keys.
|
||||
|
||||
shallow
|
||||
deep
|
||||
: Add values for new keys, merge existing.
|
||||
|
||||
Note that you don't need to be so verbose as in the default setup below; a `_merge` value higher up will be inherited if not set.
|
||||
|
|
|
@ -101,6 +101,12 @@ ignoreImports {{< new-in "0.80.0" >}}
|
|||
disable
|
||||
: Set to `true` to disable the module while keeping any version info in the `go.*` files.
|
||||
|
||||
noMounts {{< new-in "0.84.2" >}}
|
||||
: Do not mount any folder in this import.
|
||||
|
||||
noVendor
|
||||
: Never vendor this import (only allowed in main project).
|
||||
|
||||
{{< gomodules-info >}}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ categories: ["Releases"]
|
|||
|
||||
## Deep merge of theme Params
|
||||
|
||||
One of the most common complaint from Hugo theme owners/users has been about the configuration handling. Hugo has up until now only performed a shallow merge of theme `params` into the configuration.
|
||||
One of the most common complaints from Hugo theme owners/users has been about the configuration handling. Hugo has up until now only performed a shallow merge of theme `params` into the configuration.
|
||||
|
||||
With that, given this example from a theme configuration:
|
||||
|
||||
|
@ -22,7 +22,7 @@ green="#68FF33"
|
|||
red="#FF3358"
|
||||
```
|
||||
|
||||
If you would like to use the above theme, but want a different shade of red, you earlier had to copy the entire block, even the colours you're totally happy with. This was painful even the simplest setup.
|
||||
If you would like to use the above theme, but want a different shade of red, you earlier had to copy the entire block, even the colours you're totally happy with. This was painful with even the simplest setup.
|
||||
|
||||
Now you can just override the `params` keys you want to change, e.g.:
|
||||
|
||||
|
@ -56,7 +56,7 @@ We have updated the internal Instagram shortcode to pass the access token in a h
|
|||
|
||||
## New erroridf template func
|
||||
|
||||
Sometime, especially when creating themes, it is useful to be able to let the user decide if an error situation is critical enough to fail the build. The new `erroridf` produces `ERROR` log statements that can be toggled off:
|
||||
Sometimes, especially when creating themes, it is useful to be able to let the user decide if an error situation is critical enough to fail the build. The new `erroridf` produces `ERROR` log statements that can be toggled off:
|
||||
|
||||
```html
|
||||
{{ erroridf "some-custom-id" "Some error message." }}
|
||||
|
|
21
content/en/news/0.84.1-relnotes/index.md
Normal file
21
content/en/news/0.84.1-relnotes/index.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
---
|
||||
date: 2021-06-24
|
||||
title: "Hugo 0.84.1: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.84.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with a couple of important fixes.
|
||||
|
||||
* Fix language menu config regression [093dacab](https://github.com/gohugoio/hugo/commit/093dacab29a3c6fc363408453d0bc3b1fc159ad5) [@bep](https://github.com/bep) [#8672](https://github.com/gohugoio/hugo/issues/8672)
|
||||
* config: Fix merge of config with map[string]string values. [4a9d408f](https://github.com/gohugoio/hugo/commit/4a9d408fe0bbf4c563546e35d2be7ade4e920c4c) [@bep](https://github.com/bep) [#8679](https://github.com/gohugoio/hugo/issues/8679)
|
||||
* markup: Rename Header(s) to Heading(s) in ToC struct [a7e3da24](https://github.com/gohugoio/hugo/commit/a7e3da242f98d4799dad013d7ba2f285717640d6) [@bep](https://github.com/bep)
|
||||
|
||||
|
||||
|
26
content/en/news/0.84.2-relnotes/index.md
Normal file
26
content/en/news/0.84.2-relnotes/index.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
---
|
||||
date: 2021-06-28
|
||||
title: "Hugo 0.84.2: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.84.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is mostly a bug fix release, but it also contains some minor modules related improvements. Most notable you now get some more information in ` hugo config mounts`, and even more so when typing ` hugo config mounts -v`.
|
||||
|
||||
* modules: Add module.import.noMounts config [40dfdd09](https://github.com/gohugoio/hugo/commit/40dfdd09521bcb8f56150e6791d60445198f27ab) [@bep](https://github.com/bep) [#8708](https://github.com/gohugoio/hugo/issues/8708)
|
||||
* modules: Use value type for module.Time [3a6dc6d3](https://github.com/gohugoio/hugo/commit/3a6dc6d3f423c4acb79ef21b5a76e616fa2c9477) [@bep](https://github.com/bep)
|
||||
* commands: Add version time to "hugo config mounts" [6cd2110a](https://github.com/gohugoio/hugo/commit/6cd2110ab295f598907a18da91e34d31407c1d9d) [@bep](https://github.com/bep)
|
||||
* commands: Add some more info to "hugo config mounts" [6a365c27](https://github.com/gohugoio/hugo/commit/6a365c2712c7607e067e192d213b266f0c88d0f3) [@bep](https://github.com/bep)
|
||||
* Fix config handling with empty config entries after merge [19aa95fc](https://github.com/gohugoio/hugo/commit/19aa95fc7f4cd58dcc8a8ff075762cfc86d41dc3) [@bep](https://github.com/bep) [#8701](https://github.com/gohugoio/hugo/issues/8701)
|
||||
* Fix config loading for "hugo mod init" [923dd9d1](https://github.com/gohugoio/hugo/commit/923dd9d1c1f649142f3f377109318b07e0f44d5d) [@bep](https://github.com/bep) [#8697](https://github.com/gohugoio/hugo/issues/8697)
|
||||
* deps: Update to Minify v2.9.18 [d9bdd37d](https://github.com/gohugoio/hugo/commit/d9bdd37d35ccd436b4dd470ef99efa372a6a086b) [@bep](https://github.com/bep) [#8693](https://github.com/gohugoio/hugo/issues/8693)
|
||||
* Remove credit from release notes [b2eaf4c8](https://github.com/gohugoio/hugo/commit/b2eaf4c8c2e31aa1c1bc4a2c0061f661e01d2de1) [@digitalcraftsman](https://github.com/digitalcraftsman)
|
||||
|
||||
|
||||
|
20
content/en/news/0.84.3-relnotes/index.md
Normal file
20
content/en/news/0.84.3-relnotes/index.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
---
|
||||
date: 2021-06-29
|
||||
title: "Hugo 0.84.3: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.84.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with a couple of important fixes.
|
||||
|
||||
* config: Fix Netlify default cache dir logic [6c8c0c8b](https://github.com/gohugoio/hugo/commit/6c8c0c8b6a0b39b91de44d72a7bd1cd49534a0f1) [@bep](https://github.com/bep) [#8710](https://github.com/gohugoio/hugo/issues/8710)
|
||||
* config: Fix handling of invalid OS env config overrides [49fedbc5](https://github.com/gohugoio/hugo/commit/49fedbc51cafa64e4eb0eae9fb79ccbe2d4c6774) [@bep](https://github.com/bep) [#8709](https://github.com/gohugoio/hugo/issues/8709)
|
||||
|
||||
|
||||
|
20
content/en/news/0.84.4-relnotes/index.md
Normal file
20
content/en/news/0.84.4-relnotes/index.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
---
|
||||
date: 2021-07-01
|
||||
title: "Hugo 0.84.4: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.84.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with a couple of important fixes.
|
||||
|
||||
* Fix Cloudflare vs Netlify cache dir issue [4c8552b1](https://github.com/gohugoio/hugo/commit/4c8552b11477141777101e0e0609dd1f32d191e9) [@bep](https://github.com/bep) [#8714](https://github.com/gohugoio/hugo/issues/8714)
|
||||
* Fix date format in schema and opengraph templates [34e4742f](https://github.com/gohugoio/hugo/commit/34e4742f0caab0d3eb9efd00fce4157d112617b5) [@jmooring](https://github.com/jmooring) [#8671](https://github.com/gohugoio/hugo/issues/8671)
|
||||
|
||||
|
||||
|
|
@ -34,6 +34,8 @@ Layout
|
|||
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.
|
||||
|
||||
Note that if the output format's Media Type has more than one suffix defined, only the first is considered.
|
||||
|
||||
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 `index.amp.html` will be chosen before `index.fr.html`.
|
||||
|
||||
|
@ -79,7 +81,3 @@ In Hugo, layouts can live in either the project's or the themes' layout folders,
|
|||
## Examples: Layout Lookup for Term Pages
|
||||
|
||||
{{< datatable-filtered "output" "layouts" "Kind == term" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -88,21 +88,23 @@ For the second position, you would just use:
|
|||
`with` is great when the output depends on a parameter being set:
|
||||
|
||||
```
|
||||
{{ with .Get "class"}} class="{{.}}"{{ end }}
|
||||
{{ with .Get "class" }} class="{{ . }}"{{ end }}
|
||||
```
|
||||
|
||||
`.Get` can also be used to check if a parameter has been provided. This is
|
||||
most helpful when the condition depends on either of the values, or both:
|
||||
|
||||
```
|
||||
{{ if or (.Get "title") (.Get "alt") }} alt="{{ with .Get "alt"}}{{.}}{{else}}{{.Get "title"}}{{end}}"{{ end }}
|
||||
{{ if or (.Get "title") (.Get "alt") }} alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "title" }}{{ end }}"{{ end }}
|
||||
```
|
||||
|
||||
#### `.Inner`
|
||||
|
||||
If a closing shortcode is used, the `.Inner` variable will be populated with all of the content between the opening and closing shortcodes. If a closing shortcode is required, you can check the length of `.Inner` as an indicator of its existence.
|
||||
|
||||
A shortcode with content declared via the `.Inner` variable can also be declared without the inline content and without the closing shortcode by using the self-closing syntax:
|
||||
A shortcode with content declared via the `.Inner` variable can also be declared without the
|
||||
content and without the closing
|
||||
by using the self-closing syntax:
|
||||
|
||||
```
|
||||
{{</* innershortcode /*/>}}
|
||||
|
@ -128,16 +130,16 @@ The `.IsNamedParams` variable checks whether the shortcode declaration uses name
|
|||
For example, you could create an `image` shortcode that can take either a `src` named parameter or the first positional parameter, depending on the preference of the content's author. Let's assume the `image` shortcode is called as follows:
|
||||
|
||||
```
|
||||
{{</* image src="images/my-image.jpg"*/>}}
|
||||
{{</* image src="images/my-image.jpg" */>}}
|
||||
```
|
||||
|
||||
You could then include the following as part of your shortcode templating:
|
||||
|
||||
```
|
||||
{{ if .IsNamedParams }}
|
||||
<img src="{{.Get "src" }}" alt="">
|
||||
<img src="{{ .Get "src" }}" alt="">
|
||||
{{ else }}
|
||||
<img src="{{.Get 0}}" alt="">
|
||||
<img src="{{ .Get 0 }}" alt="">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
|
@ -211,17 +213,17 @@ You have created the shortcode at `/layouts/shortcodes/img.html`, which loads th
|
|||
{{< code file="/layouts/shortcodes/img.html" >}}
|
||||
<!-- image -->
|
||||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
||||
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
||||
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
|
||||
{{ if .Get "link"}}</a>{{ end }}
|
||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
||||
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
|
||||
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }} />
|
||||
{{ if .Get "link" }}</a>{{ end }}
|
||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
|
||||
<figcaption>{{ if isset .Params "title" }}
|
||||
<h4>{{ .Get "title" }}</h4>{{ end }}
|
||||
{{ if or (.Get "caption") (.Get "attr")}}<p>
|
||||
{{ if or (.Get "caption") (.Get "attr") }}<p>
|
||||
{{ .Get "caption" }}
|
||||
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
|
||||
{{ with .Get "attrlink" }}<a href="{{ . }}"> {{ end }}
|
||||
{{ .Get "attr" }}
|
||||
{{ if .Get "attrlink"}}</a> {{ end }}
|
||||
{{ if .Get "attrlink" }}</a> {{ end }}
|
||||
</p> {{ end }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
|
@ -287,7 +289,7 @@ The following is taken from `highlight`, which is a [built-in shortcode][] that
|
|||
The template for the `highlight` shortcode uses the following code, which is already included in Hugo:
|
||||
|
||||
```
|
||||
{{ .Get 0 | highlight .Inner }}
|
||||
{{ .Get 0 | highlight .Inner }}
|
||||
```
|
||||
|
||||
The rendered output of the HTML example code block will be as follows:
|
||||
|
@ -306,8 +308,8 @@ Hugo's [`.Parent` shortcode variable][parent] returns a boolean value depending
|
|||
The following example is contrived but demonstrates the concept. Assume you have a `gallery` shortcode that expects one named `class` parameter:
|
||||
|
||||
{{< code file="layouts/shortcodes/gallery.html" >}}
|
||||
<div class="{{.Get "class"}}">
|
||||
{{.Inner}}
|
||||
<div class="{{ .Get "class" }}">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
{{< /code >}}
|
||||
|
||||
|
@ -316,10 +318,10 @@ You also have an `img` shortcode with a single named `src` parameter that you wa
|
|||
{{< code file="layouts/shortcodes/img.html" >}}
|
||||
{{- $src := .Get "src" -}}
|
||||
{{- with .Parent -}}
|
||||
<img src="{{$src}}" class="{{.Get "class"}}-image">
|
||||
<img src="{{$src}}" class="{{ .Get "class" }}-image">
|
||||
{{- else -}}
|
||||
<img src="{{$src}}">
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{< /code >}}
|
||||
|
||||
You can then call your shortcode in your content as follows:
|
||||
|
@ -367,6 +369,8 @@ More shortcode examples can be found in the [shortcodes directory for spf13.com]
|
|||
|
||||
## Inline Shortcodes
|
||||
|
||||
{{< new-in "0.52.0" >}}
|
||||
|
||||
Since Hugo 0.52, you can implement your shortcodes inline -- e.g. where you use them in the content file. This can be useful for scripting that you only need in one place.
|
||||
|
||||
This feature is disabled by default, but can be enabled in your site config:
|
||||
|
|
|
@ -26,8 +26,6 @@ toc: false
|
|||
|
||||
## Commercial Services
|
||||
|
||||
* [Appernetic.io](https://appernetic.io) is a Hugo Static Site Generator as a Service that is easy to use for non-technical users.
|
||||
* **Features:** inline PageDown editor, visual tree view, image upload and digital asset management with Cloudinary, site preview, continuous integration with GitHub, atomic deploy and hosting, Git and Hugo integration, autosave, custom domain, project syncing, theme cloning and management. Developers have complete control over the source code and can manage it with GitHub’s deceptively simple workflow.
|
||||
* [DATOCMS](https://www.datocms.com) DatoCMS is a fully customizable administrative area for your static websites. Use your favorite website generator, let your clients publish new content independently, and the host the site anywhere you like.
|
||||
* [Forestry.io](https://forestry.io/). Forestry is a git-backed CMS for Hugo, Gatsby, Jekyll and VuePress websites with support for GitHub, GitLab, Bitbucket and Azure Devops. Forestry provides a nice user interface to edit and model content for non technical editors. It supports S3, Cloudinary and Netlify Large Media integrations for storing media. Every time an update is made via the CMS, Forestry will commit changes back to your repo and vice-versa.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo --gc --minify"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.84.0"
|
||||
HUGO_VERSION = "0.84.4"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
|||
command = "hugo --gc --minify --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.84.0"
|
||||
HUGO_VERSION = "0.84.4"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.84.0"
|
||||
HUGO_VERSION = "0.84.4"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.84.0"
|
||||
HUGO_VERSION = "0.84.4"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
Loading…
Reference in a new issue