mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Merge commit 'eb16165694f868d73e57b6aed5c26ba5e98229de'
This commit is contained in:
@@ -37,7 +37,6 @@ JSON
|
||||
### Example
|
||||
|
||||
{{< code-toggle >}}
|
||||
+++
|
||||
title = "spf13-vim 3.0 release and new website"
|
||||
description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
|
||||
tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
|
||||
@@ -47,8 +46,7 @@ categories = [
|
||||
"VIM"
|
||||
]
|
||||
slug = "spf13-vim-3-0-release-and-new-website"
|
||||
+++
|
||||
{{</ code-toggle >}}
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Front Matter Variables
|
||||
|
||||
|
@@ -349,12 +349,6 @@ And then in the template:
|
||||
```
|
||||
{{ i18n "readingTime" .ReadingTime }}
|
||||
```
|
||||
To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
|
||||
|
||||
```
|
||||
hugo --i18n-warnings | grep i18n
|
||||
i18n|MISSING_TRANSLATION|en|wordCount
|
||||
```
|
||||
|
||||
## Customize Dates
|
||||
|
||||
@@ -438,6 +432,13 @@ Hugo will generate your website with these missing translation placeholders. It
|
||||
|
||||
For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
|
||||
|
||||
To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
|
||||
|
||||
```
|
||||
hugo --i18n-warnings | grep i18n
|
||||
i18n|MISSING_TRANSLATION|en|wordCount
|
||||
```
|
||||
|
||||
## Multilingual Themes support
|
||||
|
||||
To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must meet the following criteria:
|
||||
|
@@ -249,7 +249,7 @@ Gets a value from the current `Page's` params set in front matter, with a fall b
|
||||
{{</* param testparam */>}}
|
||||
```
|
||||
|
||||
Since `testparam` is a param defined in front matter of this page wi the value `Hugo Rocks!`, the above will print:
|
||||
Since `testparam` is a param defined in front matter of this page with the value `Hugo Rocks!`, the above will print:
|
||||
|
||||
{{< param testparam >}}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ toc: true
|
||||
|
||||
A collection of all themes created by the Hugo community, including screenshots and demos, can be found at <https://themes.gohugo.io>. Every theme in this list will automatically be added to the theme site. Theme updates aren't scheduled but usually happen at least once a week.
|
||||
|
||||
## tl;dr
|
||||
## Adding a theme to the list
|
||||
|
||||
1. Create your theme using `hugo new theme <THEMENAME>`;
|
||||
2. Test your theme against <https://github.com/gohugoio/hugoBasicExample> \*
|
||||
|
@@ -22,20 +22,25 @@ aliases: []
|
||||
`dict` is especially useful for passing more than one value to a partial template.
|
||||
|
||||
|
||||
## Example: `dict` with Embedded SVGs
|
||||
## Example: Using `dict` to pass multiple values to a `partial`
|
||||
|
||||
The partial below creates a SVG and expects `fill` `height` and `width` from the caller:
|
||||
The partial below creates a SVG and expects `fill`, `height` and `width` from the caller:
|
||||
|
||||
**Partial definition**
|
||||
|
||||
{{< code file="layouts/partials/svgs/external-links.svg" download="external-links.svg" >}}
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="{{ .fill }}" width="{{ .size }}" height="{{ .size }}" viewBox="0 0 32 32" aria-label="External Link">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
fill="{{ .fill }}" width="{{ .width }}" height="{{ .height }}" viewBox="0 0 32 32" aria-label="External Link">
|
||||
<path d="M25.152 16.576v5.696q0 2.144-1.504 3.648t-3.648 1.504h-14.848q-2.144 0-3.648-1.504t-1.504-3.648v-14.848q0-2.112 1.504-3.616t3.648-1.536h12.576q0.224 0 0.384 0.16t0.16 0.416v1.152q0 0.256-0.16 0.416t-0.384 0.16h-12.576q-1.184 0-2.016 0.832t-0.864 2.016v14.848q0 1.184 0.864 2.016t2.016 0.864h14.848q1.184 0 2.016-0.864t0.832-2.016v-5.696q0-0.256 0.16-0.416t0.416-0.16h1.152q0.256 0 0.416 0.16t0.16 0.416zM32 1.152v9.12q0 0.48-0.352 0.8t-0.8 0.352-0.8-0.352l-3.136-3.136-11.648 11.648q-0.16 0.192-0.416 0.192t-0.384-0.192l-2.048-2.048q-0.192-0.16-0.192-0.384t0.192-0.416l11.648-11.648-3.136-3.136q-0.352-0.352-0.352-0.8t0.352-0.8 0.8-0.352h9.12q0.48 0 0.8 0.352t0.352 0.8z"></path>
|
||||
</svg>
|
||||
{{< /code >}}
|
||||
|
||||
These values can be stored in one object with `dict` and passed to the partial:
|
||||
**Partial call**
|
||||
|
||||
The `fill`, `height` and `width` values can be stored in one object with `dict` and passed to the partial:
|
||||
|
||||
{{< code file="layouts/_default/list.html" >}}
|
||||
{{ partial "svg/link-ext.svg" (dict "fill" "#01589B" "size" 10 "width" 20 ) }}
|
||||
{{ partial "svgs/external-links.svg" (dict "fill" "#01589B" "width" 10 "height" 20 ) }}
|
||||
{{< /code >}}
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
---
|
||||
title: imageConfig
|
||||
linktitle: imageConfig
|
||||
description: Parses the image and returns the height, width, and color model.
|
||||
godocref:
|
||||
|
@@ -18,9 +18,10 @@ relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
An useful example is to use it as `AND` filters when combined with where:
|
||||
|
||||
## AND filter in where query
|
||||
|
||||
```
|
||||
{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }}
|
||||
{{ $pages := $pages | union (where .Site.RegularPages "Params.pinned" true) }}
|
||||
|
@@ -29,17 +29,13 @@ As an example:
|
||||
Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English.
|
||||
|
||||
|
||||
A more practical example is to fill in the missing translations for the "minority languages" with content from the main language:
|
||||
|
||||
A more practical example is to fill in the missing translations from the other languages:
|
||||
|
||||
```bash
|
||||
{{ $pages := .Site.RegularPages }}
|
||||
{{ .Scratch.Set "pages" $pages }}
|
||||
{{ $mainSite := .Sites.First }}
|
||||
{{ if ne $mainSite .Site }}
|
||||
{{ .Scratch.Set "pages" ($pages | lang.Merge $mainSite.RegularPages) }}
|
||||
{{ end }}
|
||||
{{ $pages := .Scratch.Get "pages" }}
|
||||
{{ $pages := .Site.RegularPages }}
|
||||
{{ range .Site.Home.Translations }}
|
||||
{{ $pages = $pages | lang.Merge .Site.RegularPages }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
@@ -19,7 +19,12 @@ deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation. Here is the simplest usage:
|
||||
The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation.
|
||||
|
||||
|
||||
**Note:** Each Site (or language) has its own `partialCached` cache, so each site will execute a partial once.
|
||||
|
||||
Here is the simplest usage:
|
||||
|
||||
```
|
||||
{{ partialCached "footer.html" . }}
|
||||
|
31
docs/content/en/functions/path.Base.md
Normal file
31
docs/content/en/functions/path.Base.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: path.Base
|
||||
description: Base returns the last element of a path.
|
||||
godocref:
|
||||
date: 2018-11-28
|
||||
publishdate: 2018-11-28
|
||||
lastmod: 2018-11-28
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [path, base]
|
||||
signature: ["path.Base PATH"]
|
||||
workson: []
|
||||
hugoversion: "0.40"
|
||||
relatedfuncs: [path.Dir, path.Ext, path.Split]
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
`path.Base` returns the last element of `PATH`.
|
||||
|
||||
If `PATH` is empty, `.` is returned.
|
||||
|
||||
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
|
||||
|
||||
```
|
||||
{{ path.Base "a/news.html" }} → "news.html"
|
||||
{{ path.Base "news.html" }} → "news.html"
|
||||
{{ path.Base "a/b/c" }} → "c"
|
||||
{{ path.Base "/x/y/z/" }} → "z"
|
||||
```
|
32
docs/content/en/functions/path.Dir.md
Normal file
32
docs/content/en/functions/path.Dir.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: path.Dir
|
||||
description: Dir returns all but the last element of a path.
|
||||
godocref:
|
||||
date: 2018-11-28
|
||||
publishdate: 2018-11-28
|
||||
lastmod: 2018-11-28
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [path, dir]
|
||||
signature: ["path.Dir PATH"]
|
||||
workson: []
|
||||
hugoversion: "0.40"
|
||||
relatedfuncs: [path.Base, path.Ext, path.Split]
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
`path.Dir` returns all but the last element of `PATH`, typically `PATH`'s directory.
|
||||
|
||||
The returned path will never end in a slash.
|
||||
If `PATH` is empty, `.` is returned.
|
||||
|
||||
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
|
||||
|
||||
```
|
||||
{{ path.Dir "a/news.html" }} → "a"
|
||||
{{ path.Dir "news.html" }} → "."
|
||||
{{ path.Dir "a/b/c" }} → "a/b"
|
||||
{{ path.Dir "/x/y/z" }} → "/x/y"
|
||||
```
|
29
docs/content/en/functions/path.Ext.md
Normal file
29
docs/content/en/functions/path.Ext.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: path.Ext
|
||||
description: Ext returns the file name extension of a path.
|
||||
godocref:
|
||||
date: 2018-11-28
|
||||
publishdate: 2018-11-28
|
||||
lastmod: 2018-11-28
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [path, ext, extension]
|
||||
signature: ["path.Ext PATH"]
|
||||
workson: []
|
||||
hugoversion: "0.40"
|
||||
relatedfuncs: [path.Base, path.Dir, path.Split]
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
`path.Ext` returns the file name extension `PATH`.
|
||||
|
||||
The extension is the suffix beginning at the final dot in the final slash-separated element `PATH`;
|
||||
it is empty if there is no dot.
|
||||
|
||||
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
|
||||
|
||||
```
|
||||
{{ path.Ext "a/b/c/news.html" }} → ".html"
|
||||
```
|
29
docs/content/en/functions/path.Join.md
Normal file
29
docs/content/en/functions/path.Join.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: path.Join
|
||||
description: Join path elements into a single path.
|
||||
godocref:
|
||||
date: 2018-11-28
|
||||
publishdate: 2018-11-28
|
||||
lastmod: 2018-11-28
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [path, join]
|
||||
signature: ["path.Join ELEMENT..."]
|
||||
workson: []
|
||||
hugoversion: "0.39"
|
||||
relatedfuncs: [path.Split]
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
`path.Join` joins path elements into a single path, adding a separating slash if necessary.
|
||||
All empty strings are ignored.
|
||||
|
||||
**Note:** All path elements on Windows are converted to slash ('/') separators.
|
||||
|
||||
```
|
||||
{{ path.Join "partial" "news.html" }} → "partial/news.html"
|
||||
{{ path.Join "partial/" "news.html" }} → "partial/news.html"
|
||||
{{ path.Join "foo/baz" "bar" }} → "foo/baz/bar"
|
||||
```
|
31
docs/content/en/functions/path.Split.md
Normal file
31
docs/content/en/functions/path.Split.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: path.Split
|
||||
description: Split path immediately following the final slash.
|
||||
godocref:
|
||||
date: 2018-11-28
|
||||
publishdate: 2018-11-28
|
||||
lastmod: 2018-11-28
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [path, split]
|
||||
signature: ["path.Split PATH"]
|
||||
workson: []
|
||||
hugoversion: "0.39"
|
||||
relatedfuncs: [path.Split]
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
`path.Split` splits `PATH` immediately following the final slash, separating it into a directory and a base component.
|
||||
|
||||
The returned values have the property that `PATH` = `DIR`+`BASE`.
|
||||
If there is no slash in `PATH`, it returns an empty directory and the base is set to `PATH`.
|
||||
|
||||
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
|
||||
|
||||
```
|
||||
{{ path.Split "a/news.html" }} → "a/", "news.html"
|
||||
{{ path.Split "news.html" }} → "", "news.html"
|
||||
{{ path.Split "a/b/c" }} → "a/b/", "c"
|
||||
```
|
@@ -1,6 +1,5 @@
|
||||
---
|
||||
title: render
|
||||
# linktitle: Render
|
||||
title: .Render
|
||||
description: Takes a view to apply when rendering content.
|
||||
godocref:
|
||||
date: 2017-02-01
|
||||
@@ -11,7 +10,7 @@ menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [views]
|
||||
signature: ["render LAYOUT"]
|
||||
signature: [".Render LAYOUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
|
37
docs/content/en/functions/templates.Exists.md
Normal file
37
docs/content/en/functions/templates.Exists.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: templates.Exists
|
||||
linktitle: ""
|
||||
description: "Checks whether a template file exists under the given path relative to the `layouts` directory."
|
||||
godocref: ""
|
||||
date: 2018-11-01
|
||||
publishdate: 2018-11-01
|
||||
lastmod: 2018-11-01
|
||||
categories: [functions]
|
||||
tags: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
ns: ""
|
||||
keywords: ["templates", "template", "layouts"]
|
||||
signature: ["templates.Exists PATH"]
|
||||
workson: []
|
||||
hugoversion: "0.46"
|
||||
aliases: []
|
||||
relatedfuncs: []
|
||||
toc: false
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
A template file is any file living below the `layouts` directories of either the project or any of its theme components incudling partials and shortcodes.
|
||||
|
||||
The function is particulary handy with dynamic path. The following example ensures the build will not break on a `.Type` missing its dedicated `header` partial.
|
||||
|
||||
```go-html-template
|
||||
{{ $partialPath := printf "headers/%s.html" .Type }}
|
||||
{{ if templates.Exists ( printf "partials/%s" $partialPath ) }}
|
||||
{{ partial $partialPath . }}
|
||||
{{ else }}
|
||||
{{ partial "headers/default.html" . }}
|
||||
{{ end }}
|
||||
|
||||
```
|
@@ -35,6 +35,7 @@ Given two arrays (or slices) A and B, this function will return a new array that
|
||||
<!-- returns an error because both arrays/slices have to be of the same type -->
|
||||
```
|
||||
|
||||
## OR filter in where query
|
||||
|
||||
This is also very useful to use as `OR` filters when combined with where:
|
||||
|
||||
|
@@ -437,15 +437,15 @@ You can override any of these cache setting in your own `config.toml`.
|
||||
:cacheDir
|
||||
: This is the value of the `cacheDir` config option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache` directory below the OS temp dir for the others. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml).
|
||||
|
||||
:project
|
||||
`:project`
|
||||
|
||||
The base directory name of the current Hugo project. This means that, in its default setting, every project will have separated file caches, which means that when you do `hugo --gc` you will not touch files related to other Hugo projects running on the same PC.
|
||||
|
||||
:resourceDir
|
||||
`:resourceDir`
|
||||
: This is the value of the `resourceDir` config option.
|
||||
|
||||
maxAge
|
||||
: This is the duration before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. Uses Go's `time.Duration`, so valid values are `"10s"` (10 seconds), `"10m"` (10 minutes) and `"10m"` (10 hours).
|
||||
: This is the duration before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. Uses Go's `time.Duration`, so valid values are `"10s"` (10 seconds), `"10m"` (10 minutes) and `"10h"` (10 hours).
|
||||
|
||||
dir
|
||||
: The absolute path to where the files for this cache will be stored. Allowed starting placeholders are `:cacheDir` and `:resourceDir` (see above).
|
||||
|
@@ -128,6 +128,12 @@ You can checkout a specific version as follows:
|
||||
git checkout tags/<version-name>
|
||||
```
|
||||
|
||||
You can update a theme to the latest version by executing the following command in the *root* directory of your project:
|
||||
|
||||
```
|
||||
git submodule update --rebase --remote
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
You now have a live website served over https, distributed through CDN, and configured for continuous deployment. Dig deeper into the Netlify documentation:
|
||||
|
BIN
docs/content/en/news/0.50-relnotes/featured-hugo-50-poster.png
Normal file
BIN
docs/content/en/news/0.50-relnotes/featured-hugo-50-poster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 222 KiB |
@@ -1,12 +1,12 @@
|
||||
|
||||
---
|
||||
date: 2018-10-29
|
||||
title: "0.50"
|
||||
description: "0.50"
|
||||
title: "Hugo 0.50: Errors so Good, You’ll Want to Fail!"
|
||||
description: "Errors with full filename and line and column number, shown in browser. And improved Fast Render Mode …"
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
Hugo `0.50` brings **greatly improved error messages**, and we now also show them in the browser. Having error messages with filename, line- and column number greatly simplify troubleshooting. Many editors (like VS Code) even let you click and navigate directly to the problematic line. If your editor requires a different log format, you can set it via the `HUGO_FILE_LOG_FORMAT` OS environment variable:
|
||||
Hugo `0.50` brings **greatly improved error messages**, and we now also show them in the browser. Having error messages with filename, line- and column number greatly simplify troubleshooting. Many editors (like VS Code) even let you click and navigate directly to the problematic line. If your editor requires a different log format, you can set it via the `HUGO_FILE_LOG_FORMAT` OS environment variable:
|
||||
|
||||
|
||||
```bash
|
||||
|
BIN
docs/content/en/news/0.51-relnotes/featured-hugo-51-poster.png
Normal file
BIN
docs/content/en/news/0.51-relnotes/featured-hugo-51-poster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 KiB |
@@ -1,12 +1,12 @@
|
||||
|
||||
---
|
||||
date: 2018-11-07
|
||||
title: "0.51"
|
||||
description: "0.51"
|
||||
title: "Hugo 0.51: The 30K Stars Edition!"
|
||||
description: "Bug fixes, new template functions and more error improvements."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
Hugo reached [30 000 stars on GitHub](https://github.com/gohugoio/hugo/stargazers) this week, which is a good occasion to do a follow-up release of the great Hugo `0.50`. This is mostly a bug fix release, but it also adds some useful new functionality, two examples are the new template funcs `complement` and `symdiff`. This release also continues the work on improving Hugo's error messages. And with `.Position` now available on shortcodes, you can also improve your own error messages inside your custom shortcodes:
|
||||
Hugo reached [30 000 stars on GitHub](https://github.com/gohugoio/hugo/stargazers) this week, which is a good occasion to do a follow-up release of the great Hugo `0.50`. This is mostly a bug fix release, but it also adds some useful new functionality, two examples are the new template funcs [complement](https://gohugo.io/functions/complement/) and [symdiff](https://gohugo.io/functions/symdiff/). This release also continues the work on improving Hugo's error messages. And with `.Position` now available on shortcodes, you can also improve your own error messages inside your custom shortcodes:
|
||||
|
||||
|
||||
```bash
|
||||
|
BIN
docs/content/en/news/0.52-relnotes/featured-hugo-52-poster.png
Normal file
BIN
docs/content/en/news/0.52-relnotes/featured-hugo-52-poster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 329 KiB |
@@ -1,12 +1,12 @@
|
||||
|
||||
---
|
||||
date: 2018-11-28
|
||||
title: "0.52"
|
||||
description: "0.52"
|
||||
title: "And Now: Hugo 0.52"
|
||||
description: "Configurable file caches, inline shortcodes, and more ..."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
The two big new items in this release is [Inline Shortcodes](https://gohugo.io//templates/shortcode-templates/#inline-shortcodes) and [Consolidated File Caches](https://gohugo.io//templates/shortcode-templates/getting-started/configuration/#configure-file-caches). In Hugo we really care about build speed, and caching is important. With this release, you get much better control over your cache configuration, which is especially useful when building on a Continous Integration server (Netlify, CircleCI or similar). Inline Shortcodes was implemented to help the Bootstrap project [move their documentation](https://github.com/twbs/bootstrap/issues/24475#issuecomment-441238128) to Hugo. Note that this feature is disabled by default. To enable, set `enableInlineShortcodes = true` in your site config. Worth mentioning is also the new `param` shortcode, which looks up the param in page front matter with the site's parameter as a fall back.
|
||||
The two big new items in this release is [Inline Shortcodes](https://gohugo.io//templates/shortcode-templates/#inline-shortcodes) and [Consolidated File Caches](https://gohugo.io/getting-started/configuration/#configure-file-caches). In Hugo we really care about build speed, and caching is important. With this release, you get much better control over your cache configuration, which is especially useful when building on a Continous Integration server (Netlify, CircleCI or similar). Inline Shortcodes was implemented to help the Bootstrap project [move their documentation site](https://github.com/twbs/bootstrap/issues/24475#issuecomment-441238128) to Hugo. Note that this feature is disabled by default. To enable, set `enableInlineShortcodes = true` in your site config. Worth mentioning is also the new `param` shortcode, which looks up the param in page front matter with the site's parameter as a fall back.
|
||||
|
||||
This release represents **33 contributions by 7 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 [@moorereason](https://github.com/moorereason), [@emirb](https://github.com/emirb), and [@allizad](https://github.com/allizad) for their ongoing contributions.
|
||||
|
@@ -48,7 +48,7 @@ You can then call the shortcode as follows inside of your content's markup:
|
||||
|
||||
The above shortcode [is part of the code for the Hugo docs][dirindex]. Here it lists this site's CSS files:
|
||||
|
||||
{{< directoryindex path="/themes/gohugoioTheme/static/dist" pathURL="/css" >}}
|
||||
{{< directoryindex path="/themes/gohugoioTheme/static" pathURL="/css" >}}
|
||||
|
||||
{{% note "Slashes are Important" %}}
|
||||
The initial slash `/` in `pathURL` is important in the `directoryindex` shortcode. Otherwise, `pathURL` becomes relative to the current web page.
|
||||
|
@@ -60,6 +60,10 @@ All partials are called within your templates using the following pattern:
|
||||
One of the most common mistakes with new Hugo users is failing to pass a context to the partial call. In the pattern above, note how "the dot" (`.`) is required as the second argument to give the partial context. You can read more about "the dot" in the [Hugo templating introduction](/templates/introduction/).
|
||||
{{% /note %}}
|
||||
|
||||
{{% note %}}
|
||||
`<PARTIAL>` including `baseof` is reserved. ([#5373](https://github.com/gohugoio/hugo/issues/5373))
|
||||
{{% /note %}}
|
||||
|
||||
As shown in the above example directory structure, you can nest your directories within `partials` for better source organization. You only need to call the nested partial's path relative to the `partials` directory:
|
||||
|
||||
```
|
||||
|
@@ -19,8 +19,8 @@ toc: true
|
||||
wip: true
|
||||
---
|
||||
|
||||
{{% warning "Use Relative Links" %}}
|
||||
If you're creating a theme with plans to share it with the community, use relative URLs since users of your theme may not publish from the root of their website. See [relURL](/functions/relurl) and [absURL](/functions/absurl).
|
||||
{{% warning "Use Absolute Links" %}}
|
||||
If you're creating a theme with plans to share it on the [Hugo Themes website](https://themes.gohugo.io/) please note that your theme's demo will be available in a sub-directory of website and for the theme's assets to load properly you will need to create absolute paths in the templates by using either the [absURL](/functions/absurl) function or `.Permalink`. Also make sure not to use a forward slash `/` in the beginning of a `PATH`, because Hugo will turn it into a relative URL and the `absURL` function will have no effect.
|
||||
{{% /warning %}}
|
||||
|
||||
Hugo can initialize a new blank theme directory within your existing `themes` using the `hugo new` command:
|
||||
|
@@ -30,3 +30,4 @@ A static website with a dynamic search function? Yes. As alternatives to embedda
|
||||
## 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.
|
||||
* [Bonsai](https://www.bonsai.io) is a fully-managed hosted Elasticsearch service that is fast, reliable, and simple to set up. Easily ingest your docs from Hugo into Elasticsearch following [this guide from the docs](https://docs.bonsai.io/docs/hugo).
|
||||
|
@@ -33,9 +33,13 @@ The `.File` object contains the following fields:
|
||||
.File.TranslationBaseName
|
||||
: the filename without extension or optional language identifier (e.g., `foo`)
|
||||
|
||||
.File.ContentBaseName
|
||||
: is a either TranslationBaseName or name of containing folder if file is a leaf bundle.
|
||||
|
||||
.File.BaseFileName
|
||||
: the filename without extension (e.g., `foo.en`)
|
||||
|
||||
|
||||
.File.Ext
|
||||
: the file extension of the content file (e.g., `md`); this can also be called using `.File.Extension` as well. Note that it is *only* the extension without `.`.
|
||||
|
||||
@@ -45,4 +49,4 @@ The `.File` object contains the following fields:
|
||||
.File.Dir
|
||||
: given the path `content/posts/dir1/dir2/`, the relative directory path of the content file will be returned (e.g., `posts/dir1/dir2/`)
|
||||
|
||||
[Multilingual]: /content-management/multilingual/
|
||||
[Multilingual]: /content-management/multilingual/
|
||||
|
@@ -156,6 +156,12 @@ http://remarkjs.com)
|
||||
.Site
|
||||
: see [Site Variables](/variables/site/).
|
||||
|
||||
.Sites
|
||||
: returns all sites (languages). A typical use case would be to link back to the main language: `<a href="{{ .Sites.First.Home.RelPermalink }}">...</a>`.
|
||||
|
||||
.Sites.First
|
||||
: returns the site for the first language. If this is not a multilingual setup, it will return itself.
|
||||
|
||||
.Summary
|
||||
: a generated summary of the content for easily showing a snippet in a summary view. The breakpoint can be set manually by inserting <code><!--more--></code> at the appropriate place in the content page. See [Content Summaries](/content-management/summaries/) for more details.
|
||||
|
||||
|
Reference in New Issue
Block a user