Squashed 'docs/' changes from 39a7fac34..316cec249
316cec249 Update future events template example (#1595) 3bde7d489 Install mage outside module (#1592) 762e27eff Clarify ignoreFiles regex matching 4d0032051 Add id attribute to h2 elements (#1590) 8262b077c Improve inline resource examples (#1587) 2eae7c7ec fix disqus example name (#1588) a772f4804 Added install instructions for openSUSE Tumbleweed (#1459) 7ad1c301b Remove screen capture from Hosting on GitHub page (#1586) a58541f49 add more details on about gh-pages and baseURL on hosting-on-github.md (#1346) 3bd0b46dc Update configuration page (#1585) 4cf1f013e Update OS functions 2c45a95c2 Remove getting-started/code-toggle/ 40fdff598 Describe artificial language private use subtags (#1577) 91011d210 Remove google_news from list of internal templates (#1576) 36c7879e4 Update the .Unix function 731063488 Remove a showcase 818c371a0 Update index.md 3136d39d9 netlify: Hugo 0.89.4 092bc9278 Merge branch 'tempv0.89.4' 18e01f105 releaser: Add release notes to /docs for release of 0.89.4 79135281f Correct and sort list of target image formats (#1574) af4170c7e netlify: Hugo 0.89.3 7f5444251 Merge branch 'tempv0.89.3' a32e4a6c2 releaser: Add release notes to /docs for release of 0.89.3 6dd3dc3f9 Update configuration.md 5fbe741d7 Update index.md (#1570) 37a69496f netlify: Bump to Hugo 0.89.2 3b293f1f4 Merge branch 'tempv0.89.2' 64c934e7a releaser: Add release notes to /docs for release of 0.89.2 919c51c7d Update index.md 13dd463b1 netlify: Hugo 0.89.1 d8cda1474 releaser: Add release notes to /docs for release of 0.89.1 a2adf7742 releaser: Add release notes to /docs for release of 0.89.1 c3088c4fc Add code toggle to menus page (#1568) 2d0f38978 Remove blank lines from code-toggle output (#1564) 7cf058bfd Add localization examples (#1563) cf8627c2e Fixing typos, fixing incomplete link (#1561) c78cc014b Document the removePathAccents setting 70beddaf4 Make corrections to 0.89.0 release notes (#1560) 1917195f0 Update index.md 7fb8e070c Run hugo --gc 1772d45fb Release 0.89.0 d9006179b Merge branch 'tempv0.89.0' 8db86b61e releaser: Add release notes to /docs for release of 0.89.0 abf268571 docs: Regen CLI docs fbbdb0ab1 Update the timeout default 9cbd1c15a Fix description of lang.FormatNumberCustom 6043b54cc Remove "render" keyword from Host on Render page f8ea8e84f Clarify description of front matter url (#1557) 91a0c9954 Update Twitter shortcode oEmbed endpoint 79a7405b8 Merge commit 'aa5ac36a3eb68b86c803caec703869efefc8447e' 57667bae6 hugofs: Add includeFiles and excludeFiles to mount configuration 0c9ee0a04 Allow multiple plugins in the PostCSS options map 155799e6b docs: Create path.Clean documentation git-subtree-dir: docs git-subtree-split: 316cec2494dc5f908283289371d74f36a73d3d8d
|
@ -9,9 +9,9 @@ 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.
|
||||
Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if markup.highlight.noClasses is disabled in config.
|
||||
|
||||
See https://help.farbox.com/pygments.html for preview of available styles
|
||||
See https://xyproto.github.io/splash/docs/all.html for a preview of the available styles
|
||||
|
||||
```
|
||||
hugo gen chromastyles [flags]
|
||||
|
@ -23,7 +23,7 @@ hugo gen chromastyles [flags]
|
|||
-h, --help help for chromastyles
|
||||
--highlightStyle string style used for highlighting lines (see https://github.com/alecthomas/chroma) (default "bg:#ffffcc")
|
||||
--linesStyle string style used for line numbers (see https://github.com/alecthomas/chroma)
|
||||
--style string highlighter style (see https://help.farbox.com/pygments.html) (default "friendly")
|
||||
--style string highlighter style (see https://xyproto.github.io/splash/docs/) (default "friendly")
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
@ -65,7 +65,7 @@ audio
|
|||
: an array of paths to audio files related to the page; used by the `opengraph` [internal template](/templates/internal) to populate `og:audio`.
|
||||
|
||||
cascade
|
||||
: a map of Front Matter keys whose values are passed down to the page's descendents unless overwritten by self or a closer ancestor's cascade. See [Front Matter Cascade](#front-matter-cascade) for details.
|
||||
: a map of Front Matter keys whose values are passed down to the page's descendants unless overwritten by self or a closer ancestor's cascade. See [Front Matter Cascade](#front-matter-cascade) for details.
|
||||
|
||||
date
|
||||
: the datetime assigned to this page. This is usually fetched from the `date` field in front matter, but this behaviour is configurable.
|
||||
|
@ -128,8 +128,7 @@ type
|
|||
: the type of the content; this value will be automatically derived from the directory (i.e., the [section][]) if not specified in front matter.
|
||||
|
||||
url
|
||||
: the full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of
|
||||
the multilingual feature.
|
||||
: the full path to the content from the web root. It makes no assumptions about the path of the content file. See [URL Management](/content-management/urls/#set-url-in-front-matter).
|
||||
|
||||
videos
|
||||
: an array of paths to videos related to the page; used by the `opengraph` [internal template](/templates/internal) to populate `og:video`.
|
||||
|
@ -157,7 +156,7 @@ show_comments: false
|
|||
|
||||
## Front Matter Cascade
|
||||
|
||||
Any node or section can pass down to descendents a set of Front Matter values as long as defined underneath the reserved `cascade` Front Matter key.
|
||||
Any node or section can pass down to descendants a set of Front Matter values as long as defined underneath the reserved `cascade` Front Matter key.
|
||||
|
||||
### Target Specific Pages
|
||||
|
||||
|
@ -202,9 +201,9 @@ cascade:
|
|||
banner: images/typewriter.jpg
|
||||
{{</ code-toggle >}}
|
||||
|
||||
With the above example the Blog section page and its descendents will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
|
||||
With the above example the Blog section page and its descendants will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
|
||||
|
||||
- Said descendent has its own `banner` value set
|
||||
- Said descendant has its own `banner` value set
|
||||
- Or a closer ancestor node has its own `cascade.banner` value set.
|
||||
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ See https://github.com/disintegration/imaging for more. If you want to trade qua
|
|||
|
||||
By default the images is encoded in the source format, but you can set the target format as an option.
|
||||
|
||||
Valid values are `jpg`, `png`, `tif`, `bmp`, `gif` and `webp`.
|
||||
Valid values are `bmp`, `gif`, `jpeg`, `jpg`, `png`, `tif`, `tiff`, and `webp`.
|
||||
|
||||
```go
|
||||
{{ $image.Resize "600x jpg" }}
|
||||
|
|
|
@ -12,7 +12,7 @@ menu:
|
|||
docs:
|
||||
parent: "content-management"
|
||||
weight: 120
|
||||
weight: 120 #rem
|
||||
weight: 120
|
||||
aliases: [/extras/menus/]
|
||||
toc: true
|
||||
---
|
||||
|
@ -48,31 +48,24 @@ If all you need to do is add an entry to a menu, the simple form works well.
|
|||
|
||||
#### A Single Menu
|
||||
|
||||
```
|
||||
---
|
||||
{{< code-toggle >}}
|
||||
menu: "main"
|
||||
---
|
||||
```
|
||||
{{< /code-toggle >}}
|
||||
|
||||
#### Multiple Menus
|
||||
|
||||
```
|
||||
---
|
||||
{{< code-toggle >}}
|
||||
menu: ["main", "footer"]
|
||||
---
|
||||
```
|
||||
{{< /code-toggle >}}
|
||||
|
||||
#### Advanced
|
||||
|
||||
|
||||
```
|
||||
---
|
||||
{{< code-toggle >}}
|
||||
menu:
|
||||
docs:
|
||||
parent: 'extras'
|
||||
weight: 20
|
||||
---
|
||||
```
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Add Non-content Entries to a Menu
|
||||
|
||||
|
@ -130,7 +123,6 @@ A common use case is to define a custom param to add a css class to a specific m
|
|||
class = "highlight-menu-item"
|
||||
{{</ code-toggle >}}
|
||||
|
||||
|
||||
## Render Menus
|
||||
|
||||
See [Menu Templates](/templates/menu-templates/) for information on how to render your site menus within your templates.
|
||||
|
|
|
@ -19,7 +19,7 @@ toc: true
|
|||
|
||||
You should define the available languages in a `languages` section in your site configuration.
|
||||
|
||||
> Also See [Hugo Multilingual Part 1: Content translation](https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/)
|
||||
> Also See [Hugo Multilingual Part 1: Content translation]
|
||||
|
||||
## Configure Languages
|
||||
|
||||
|
@ -63,7 +63,7 @@ Anything not defined in a `languages` block will fall back to the global value f
|
|||
With the configuration above, all content, sitemap, RSS feeds, paginations,
|
||||
and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French.
|
||||
|
||||
When working with front matter `Params` in [single page templates][singles], omit the `params` in the key for the translation.
|
||||
When working with front matter `Params` in [single page templates], omit the `params` in the key for the translation.
|
||||
|
||||
`defaultContentLanguage` sets the project's default language. If not set, the default language will be `en`.
|
||||
|
||||
|
@ -83,25 +83,24 @@ disableLanguages = ["fr", "ja"]
|
|||
|
||||
Note that you cannot disable the default content language.
|
||||
|
||||
We kept this as a standalone setting to make it easier to set via [OS environment](/getting-started/configuration/#configure-with-environment-variables):
|
||||
We kept this as a standalone setting to make it easier to set via [OS environment]:
|
||||
|
||||
```bash
|
||||
HUGO_DISABLELANGUAGES="fr ja" hugo
|
||||
```
|
||||
|
||||
If you have already a list of disabled languages in `config.toml`, you can enable them in development like this:
|
||||
|
||||
```bash
|
||||
HUGO_DISABLELANGUAGES=" " hugo server
|
||||
```
|
||||
|
||||
|
||||
### Configure Multilingual Multihost
|
||||
|
||||
From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details.
|
||||
|
||||
This means that you can now configure a `baseURL` per `language`:
|
||||
|
||||
|
||||
> If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different.
|
||||
|
||||
Example:
|
||||
|
@ -123,7 +122,7 @@ title = "In English"
|
|||
|
||||
With the above, the two sites will be generated into `public` with their own root:
|
||||
|
||||
```bash
|
||||
```text
|
||||
public
|
||||
├── en
|
||||
└── fr
|
||||
|
@ -133,7 +132,7 @@ public
|
|||
|
||||
When you run `hugo server` we will start multiple HTTP servers. You will typically see something like this in the console:
|
||||
|
||||
```bash
|
||||
```text
|
||||
Web Server is available at 127.0.0.1:1313 (bind address 127.0.0.1)
|
||||
Web Server is available at 127.0.0.1:1314 (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
|
@ -145,7 +144,6 @@ Live reload and `--navigateToChanged` between the servers work as expected.
|
|||
|
||||
Taxonomies and [Blackfriday configuration][config] can also be set per language:
|
||||
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
[Taxonomies]
|
||||
tag = "tags"
|
||||
|
@ -195,7 +193,6 @@ If a file has no language code, it will be assigned the default language.
|
|||
This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` param.
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
|
||||
languages:
|
||||
en:
|
||||
weight: 10
|
||||
|
@ -205,7 +202,6 @@ languages:
|
|||
weight: 20
|
||||
languageName: "Français"
|
||||
contentDir: "content/french"
|
||||
|
||||
{{< /code-toggle >}}
|
||||
|
||||
The value of `contentDir` can be any valid path -- even absolute path references. The only restriction is that the content directories cannot overlap.
|
||||
|
@ -222,7 +218,7 @@ Their language is __assigned__ according to the content directory they are __pla
|
|||
|
||||
By having the same **path and basename** (relative to their language content directory), the content pieces are __linked__ together as translated pages.
|
||||
|
||||
### Bypassing default linking.
|
||||
### Bypassing default linking
|
||||
|
||||
Any pages sharing the same `translationKey` set in front matter will be linked as translated pages regardless of basename or location.
|
||||
|
||||
|
@ -232,14 +228,12 @@ Considering the following example:
|
|||
2. `/content/om.nn.md`
|
||||
3. `/content/presentation/a-propos.fr.md`
|
||||
|
||||
```yaml
|
||||
# set in all three pages
|
||||
{{< code-toggle >}}
|
||||
translationKey: "about"
|
||||
```
|
||||
{{< /code-toggle >}}
|
||||
|
||||
By setting the `translationKey` front matter param to `about` in all three pages, they will be __linked__ as translated pages.
|
||||
|
||||
|
||||
### Localizing permalinks
|
||||
|
||||
Because paths and filenames are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory).
|
||||
|
@ -253,7 +247,6 @@ Title: A Propos
|
|||
slug: "a-propos"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
At render, Hugo will build both `/about/` and `/fr/a-propos/` while maintaining their translation linking.
|
||||
|
||||
{{% note %}}
|
||||
|
@ -292,7 +285,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, whether a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page.
|
||||
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, whether 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.
|
||||
|
||||
|
@ -300,7 +293,6 @@ The above also uses the [`i18n` function][i18func] described in the next section
|
|||
|
||||
`.AllTranslations` on a `Page` can be used to list all translations, including the page itself. On the home page it can be used to build a language navigator:
|
||||
|
||||
|
||||
{{< code file="layouts/partials/allLanguages.html" >}}
|
||||
<ul>
|
||||
{{ range $.Site.Home.AllTranslations }}
|
||||
|
@ -311,22 +303,24 @@ The above also uses the [`i18n` function][i18func] described in the next section
|
|||
|
||||
## Translation of Strings
|
||||
|
||||
Hugo uses [go-i18n][] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows.
|
||||
Hugo uses [go-i18n] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows.
|
||||
|
||||
Translations are collected from the `themes/<THEME>/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646][] with names such as `en-US.toml`, `fr.toml`, etc.
|
||||
Translations are collected from the `themes/<THEME>/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646] with names such as `en-US.toml`, `fr.toml`, etc.
|
||||
|
||||
{{% note %}}
|
||||
From **Hugo 0.31** you no longer need to use a valid language code. It can be anything.
|
||||
Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7](https://datatracker.ietf.org/doc/html/rfc5646#section-2.2.7) are also supported. You may omit the `art-x-` prefix for brevity. For example:
|
||||
|
||||
See https://github.com/gohugoio/hugo/issues/3564
|
||||
```text
|
||||
art-x-hugolang
|
||||
hugolang
|
||||
```
|
||||
|
||||
{{% /note %}}
|
||||
Private use subtags must not exceed 8 alphanumeric characters.
|
||||
|
||||
### Query basic translation
|
||||
|
||||
From within your templates, use the `i18n` function like this:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ i18n "home" }}
|
||||
```
|
||||
|
||||
|
@ -339,7 +333,7 @@ other = "Home"
|
|||
|
||||
The result will be
|
||||
|
||||
```
|
||||
```text
|
||||
Home
|
||||
```
|
||||
|
||||
|
@ -347,7 +341,7 @@ Home
|
|||
|
||||
Often you will want to use the page variables in the translation strings. To do so, pass the `.` context when calling `i18n`:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ i18n "wordCount" . }}
|
||||
```
|
||||
|
||||
|
@ -360,7 +354,7 @@ other = "This article has {{ .WordCount }} words."
|
|||
|
||||
Assume `.WordCount` in the context has value is 101. The result will be:
|
||||
|
||||
```
|
||||
```text
|
||||
This article has 101 words.
|
||||
```
|
||||
|
||||
|
@ -368,7 +362,7 @@ This article has 101 words.
|
|||
|
||||
In order to meet singular/plural requirement, you must pass a dictionary (map) with a numeric `.Count` property to the `i18n` function. The below example uses `.ReadingTime` variable which has a built-in `.Count` property.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ i18n "readingTime" .ReadingTime }}
|
||||
```
|
||||
|
||||
|
@ -382,52 +376,122 @@ other = "{{.Count}} minutes to read"
|
|||
|
||||
Assume `.ReadingTime.Count` in the context has value of 525600. The result will be:
|
||||
|
||||
```
|
||||
```text
|
||||
525600 minutes to read
|
||||
```
|
||||
|
||||
If `.ReadingTime.Count` in the context has value is 1. The result is:
|
||||
|
||||
```
|
||||
```text
|
||||
One minute to read
|
||||
```
|
||||
|
||||
In case you need to pass custom data: (`(dict "Count" 25)` is minimum requirement)
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ i18n "readingTime" (dict "Count" 25 "FirstArgument" true "SecondArgument" false "Etc" "so on, so far") }}
|
||||
```
|
||||
|
||||
## Localization
|
||||
|
||||
## Customize Dates
|
||||
The following localization examples assume your site's primary language is English, with translations to French and German.
|
||||
|
||||
At the time of this writing, Go does not yet have support for internationalized locales for dates, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content:
|
||||
{{< code-toggle file="config" >}}
|
||||
defaultContentLang = 'en'
|
||||
|
||||
~~~yaml
|
||||
1: "janvier"
|
||||
2: "février"
|
||||
3: "mars"
|
||||
4: "avril"
|
||||
5: "mai"
|
||||
6: "juin"
|
||||
7: "juillet"
|
||||
8: "août"
|
||||
9: "septembre"
|
||||
10: "octobre"
|
||||
11: "novembre"
|
||||
12: "décembre"
|
||||
~~~
|
||||
[languages]
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageName = 'English'
|
||||
weight = 1
|
||||
[languages.fr]
|
||||
contentDir = 'content/fr'
|
||||
languageName = 'Français'
|
||||
weight = 2
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
languageName = 'Deutsch'
|
||||
weight = 3
|
||||
|
||||
...then index the non-English date names in your templates like so:
|
||||
{{< /code-toggle >}}
|
||||
|
||||
~~~html
|
||||
<time class="post-date" datetime="{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}">
|
||||
Article publié le {{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }} (dernière modification le {{ .Lastmod.Day }} {{ index $.Site.Data.mois (printf "%d" .Lastmod.Month) }} {{ .Lastmod.Year }})
|
||||
</time>
|
||||
~~~
|
||||
### Dates
|
||||
|
||||
This technique extracts the day, month and year by specifying ``.Date.Day``, ``.Date.Month``, and ``.Date.Year``, and uses the month number as a key, when indexing the month name data file.
|
||||
With this front matter:
|
||||
|
||||
{{< code-toggle >}}
|
||||
date = 2021-11-03T12:34:56+01:00
|
||||
{{< /code-toggle >}}
|
||||
|
||||
And this template code:
|
||||
|
||||
```go-html-template
|
||||
{{ .Date | time.Format ":date_full" }}
|
||||
```
|
||||
|
||||
The rendered page displays:
|
||||
|
||||
Language|Value
|
||||
:--|:--
|
||||
English|Wednesday, November 3, 2021
|
||||
Français|mercredi 3 novembre 2021
|
||||
Deutsch|Mittwoch, 3. November 2021
|
||||
|
||||
See [time.Format] for details.
|
||||
|
||||
### Currency
|
||||
|
||||
With this template code:
|
||||
|
||||
```go-html-template
|
||||
{{ 512.5032 | lang.FormatCurrency 2 "USD" }}
|
||||
```
|
||||
|
||||
The rendered page displays:
|
||||
|
||||
Language|Value
|
||||
:--|:--
|
||||
English|$512.50
|
||||
Français|512,50 $US
|
||||
Deutsch|512,50 $
|
||||
|
||||
See [lang.FormatCurrency] and [lang.FormatAccounting] for details.
|
||||
|
||||
### Numbers
|
||||
|
||||
With this template code:
|
||||
|
||||
```go-html-template
|
||||
{{ 512.5032 | lang.FormatNumber 2 }}
|
||||
```
|
||||
|
||||
The rendered page displays:
|
||||
|
||||
Language|Value
|
||||
:--|:--
|
||||
English|512.50
|
||||
Français|512,50
|
||||
Deutsch|512,50
|
||||
|
||||
See [lang.FormatNumber] and [lang.FormatNumberCustom] for details.
|
||||
|
||||
### Percentages
|
||||
|
||||
With this template code:
|
||||
|
||||
```go-html-template
|
||||
{{ 512.5032 | lang.FormatPercent 2 }} ---> 512.50%
|
||||
```
|
||||
|
||||
The rendered page displays:
|
||||
|
||||
Language|Value
|
||||
:--|:--
|
||||
English|512.50%
|
||||
Français|512,50 %
|
||||
Deutsch|512,50 %
|
||||
|
||||
See [lang.FormatPercent] for details.
|
||||
|
||||
## Menus
|
||||
|
||||
|
@ -445,7 +509,6 @@ url = "/"
|
|||
name = "Home"
|
||||
weight = 0
|
||||
|
||||
|
||||
[languages.de]
|
||||
weight = 10
|
||||
languageName = "Deutsch"
|
||||
|
@ -458,7 +521,7 @@ weight = 0
|
|||
|
||||
The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu in the current language. Note that `absLangURL` below will link to the correct locale of your website. Without it, menu entries in all languages would link to the English version, since it's the default content language that resides in the root directory.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
<ul>
|
||||
{{- $currentPage := . -}}
|
||||
{{ range .Site.Menus.main -}}
|
||||
|
@ -467,7 +530,6 @@ The rendering of the main navigation works as usual. `.Site.Menus` will just con
|
|||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
|
||||
```
|
||||
|
||||
## Missing Translations
|
||||
|
@ -480,11 +542,11 @@ While translating a Hugo website, it can be handy to have a visual indicator of
|
|||
Hugo will generate your website with these missing translation placeholders. It might not be suitable for production environments.
|
||||
{{% /note %}}
|
||||
|
||||
For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
|
||||
For merging of content from other languages (i.e. missing content translations), see [lang.Merge].
|
||||
|
||||
To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
|
||||
|
||||
```
|
||||
```bash
|
||||
hugo --i18n-warnings | grep i18n
|
||||
i18n|MISSING_TRANSLATION|en|wordCount
|
||||
```
|
||||
|
@ -504,8 +566,17 @@ If there is more than one language defined, the `LanguagePrefix` variable will e
|
|||
[go-i18n-source]: https://github.com/nicksnyder/go-i18n
|
||||
[go-i18n]: https://github.com/nicksnyder/go-i18n
|
||||
[homepage]: /templates/homepage/
|
||||
[Hugo Multilingual Part 1: Content translation]: https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/
|
||||
[i18func]: /functions/i18n/
|
||||
[lang.FormatAccounting]: /functions/lang/#langformataccounting
|
||||
[lang.FormatCurrency]: /functions/lang/#langformatcurrency
|
||||
[lang.FormatNumber]: /functions/lang/#langformatnumber
|
||||
[lang.FormatNumberCustom]: functions/lang/#langformatnumbercustom
|
||||
[lang.FormatPercent]: /functions/lang/#langformatpercent
|
||||
[lang.Merge]: /functions/lang.merge/
|
||||
[menus]: /content-management/menus/
|
||||
[OS environment]: /getting-started/configuration/#configure-with-environment-variables
|
||||
[rellangurl]: /functions/rellangurl
|
||||
[RFC 5646]: https://tools.ietf.org/html/rfc5646
|
||||
[singles]: /templates/single-page-templates/
|
||||
[single page templates]: /templates/single-page-templates/
|
||||
[time.Format]: /functions/dateformat
|
||||
|
|
|
@ -24,12 +24,12 @@ Hugo `0.32` announced page-relative images and other resources packaged into `Pa
|
|||
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.
|
||||
The illustration shows three bundles. Note that the home page bundle cannot contain other content pages, although other files (images etc.) are allowed.
|
||||
{{< /imgproc >}}
|
||||
|
||||
|
||||
{{% note %}}
|
||||
The bundle documentation is **work in progress**. We will publish more comprehensive docs about this soon.
|
||||
The bundle documentation is a **work in progress**. We will publish more comprehensive docs about this soon.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ In Hugo, your content should be organized in a manner that reflects the rendered
|
|||
|
||||
While Hugo supports content nested at any level, the top levels (i.e. `content/<DIRECTORIES>`) are special in Hugo and are considered the content type used to determine layouts etc. To read more about sections, including how to nest them, see [sections][].
|
||||
|
||||
Without any additional configuration, the following will just work:
|
||||
Without any additional configuration, the following will automatically work:
|
||||
|
||||
```
|
||||
.
|
||||
|
@ -70,7 +70,7 @@ The following demonstrates the relationships between your content organization a
|
|||
**Tip:** You can get a reference to the content and metadata in `_index.md` using the [`.Site.GetPage` function](/functions/getpage/).
|
||||
{{% /note %}}
|
||||
|
||||
You can keep one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
|
||||
You can create one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
|
||||
|
||||
|
||||
```
|
||||
|
@ -96,12 +96,12 @@ At build, this will output to the following destination with the associated valu
|
|||
https://example.com/posts/index.html
|
||||
```
|
||||
|
||||
The [sections][] can be nested as deeply as you need. The important part to understand is, that to make the section tree fully navigational, at least the lower-most section needs a content file. (i.e. `_index.md`).
|
||||
The [sections] can be nested as deeply as you want. The important thing to understand is that to make the section tree fully navigational, at least the lower-most section must include a content file. (i.e. `_index.md`).
|
||||
|
||||
|
||||
### Single Pages in Sections
|
||||
|
||||
Single content files in each of your sections are going to be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
|
||||
Single content files in each of your sections will be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
|
||||
|
||||
|
||||
```
|
||||
|
@ -112,7 +112,7 @@ Single content files in each of your sections are going to be rendered as [singl
|
|||
content/posts/my-first-hugo-post.md
|
||||
```
|
||||
|
||||
When Hugo builds your site, the content will be outputted to the following destination:
|
||||
When Hugo builds your site, the content will be output to the following destination:
|
||||
|
||||
```
|
||||
|
||||
|
@ -128,11 +128,11 @@ https://example.com/posts/my-first-hugo-post/index.html
|
|||
|
||||
## Paths Explained
|
||||
|
||||
The following concepts will provide more insight into the relationship between your project's organization and the default behaviors of Hugo when building the output website.
|
||||
The following concepts provide more insight into the relationship between your project's organization and the default Hugo behavior when building output for the website.
|
||||
|
||||
### `section`
|
||||
|
||||
A default content type is determined by a piece of content's section. `section` is determined by the location within the project's `content` directory. `section` *cannot* be specified or overridden in front matter.
|
||||
A default content type is determined by the section in which a content item is stored. `section` is determined by the location within the project's `content` directory. `section` *cannot* be specified or overridden in front matter.
|
||||
|
||||
### `slug`
|
||||
|
||||
|
@ -152,24 +152,24 @@ A content's `path` is determined by the section's path to the file. The file `pa
|
|||
|
||||
The `url` is the relative URL for the piece of content. The `url`
|
||||
|
||||
* is based on the content's location within the directory structure OR
|
||||
* is defined in front matter and *overrides all the above*
|
||||
* is based on the content item's location within the directory structure OR
|
||||
* is defined in front matter, in which case it *overrides all the above*
|
||||
|
||||
## Override Destination Paths via Front Matter
|
||||
|
||||
Hugo believes that you organize your content with a purpose. The same structure that works to organize your source content is used to organize the rendered site. As displayed above, the organization of the source content will be mirrored in the destination.
|
||||
Hugo assumes that your content is organized with a purpose. The same structure that you use to organize your source content is used to organize the rendered site. As displayed above, the organization of the source content will be mirrored at the destination.
|
||||
|
||||
There are times where you may need more control over your content. In these cases, there are fields that can be specified in the front matter to determine the destination of a specific piece of content.
|
||||
There are times when you may need more fine-grained control over the content organization. In such cases, the front matter field can be used to determine the destination of a specific piece of content.
|
||||
|
||||
The following items are defined in this order for a specific reason: items explained further down in the list will override earlier items, and not all of these items can be defined in front matter:
|
||||
The following items are defined in a specific order for a reason: items explained lower down in the list override higher items. Note that not all items can be defined in front matter.
|
||||
|
||||
### `filename`
|
||||
|
||||
This isn't in the front matter, but is the actual name of the file minus the extension. This will be the name of the file in the destination (e.g., `content/posts/my-post.md` becomes `example.com/posts/my-post/`).
|
||||
`filename` is not a front matter field. It is the actual file name, minus the extension. This will be the name of the file in the destination (e.g., `content/posts/my-post.md` becomes `example.com/posts/my-post/`).
|
||||
|
||||
### `slug`
|
||||
|
||||
When defined in the front matter, the `slug` can take the place of the filename for the destination.
|
||||
When defined in the front matter, the `slug` can take the place of the filename in the destination.
|
||||
|
||||
{{< code file="content/posts/old-post.md" >}}
|
||||
---
|
||||
|
@ -186,11 +186,11 @@ example.com/posts/new-post/
|
|||
|
||||
### `section`
|
||||
|
||||
`section` is determined by a content's location on disk and *cannot* be specified in the front matter. See [sections][] for more information.
|
||||
`section` is determined by a content item's location on disk and *cannot* be specified in the front matter. See [sections] for more information.
|
||||
|
||||
### `type`
|
||||
|
||||
A content's `type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [types][]. This can come in especially handy when you want a piece of content to render using a different layout. In the following example, you can create a layout at `layouts/new/mylayout.html` that Hugo will use to render this piece of content, even in the midst of many other posts.
|
||||
A content item's `type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [types]. This can come in especially handy when you want a piece of content to render using a different layout. In the following example, you can create a layout at `layouts/new/mylayout.html` that Hugo will use to render this piece of content, even in the midst of many other posts.
|
||||
|
||||
{{< code file="content/posts/my-post.md" >}}
|
||||
---
|
||||
|
@ -206,7 +206,7 @@ layout: mylayout
|
|||
|
||||
### `url`
|
||||
|
||||
A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the baseURL (starting with a `/`). `url` will be used exactly as it provided in the front matter and will ignore the `--uglyURLs` setting in your site configuration:
|
||||
A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the baseURL (starting with a `/`). `url` will be used exactly as it is defined in the front matter, and will ignore the `--uglyURLs` setting in your site configuration:
|
||||
|
||||
{{< code file="content/posts/old-url.md" >}}
|
||||
---
|
||||
|
|
|
@ -60,7 +60,22 @@ RelPermalink
|
|||
: The relative URL to the resource. Resources of type `page` will have no value.
|
||||
|
||||
Content
|
||||
: The content of the resource itself. For most resources, this returns a string with the contents of the file. This can be used to inline some resources, such as `<script>{{ (.Resources.GetMatch "myscript.js").Content | safeJS }}</script>` or `<img src="{{ (.Resources.GetMatch "mylogo.png").Content | base64Encode }}">`.
|
||||
: The content of the resource itself. For most resources, this returns a string
|
||||
with the contents of the file. Use this to create inline resources.
|
||||
|
||||
```go-html-template
|
||||
{{ with .Resources.GetMatch "script.js" }}
|
||||
<script>{{ .Content | safeJS }}</script>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Resources.GetMatch "style.css" }}
|
||||
<style>{{ .Content | safeCSS }}</style>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Resources.GetMatch "img.png" }}
|
||||
<img src="data:{{ .MediaType }};base64,{{ .Content | base64Encode }}">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
MediaType
|
||||
: The MIME type of the resource, such as `image/jpeg`.
|
||||
|
|
|
@ -123,7 +123,7 @@ toLower
|
|||
|
||||
This feature has been in the back log and requested by many for a long time. The development got this recent kick start from this Twitter thread:
|
||||
|
||||
{{< tweet 898398437527363585 >}}
|
||||
{{< tweet user="scott_lowe" id="898398437527363585" >}}
|
||||
|
||||
Scott S. Lowe removed the "Related Content" section built using the `intersect` template function on tags, and the build time dropped from 30 seconds to less than 2 seconds on his 1700 content page sized blog.
|
||||
|
||||
|
|
|
@ -310,15 +310,15 @@ Assuming that standard Hugo pretty URLs are turned on.
|
|||
You want to include a single tweet into your blog post? Everything you need is the URL of the tweet:
|
||||
|
||||
```
|
||||
https://twitter.com/spf13/status/877500564405444608
|
||||
https://twitter.com/SanDiegoZoo/status/1453110110599868418
|
||||
```
|
||||
|
||||
#### Example `tweet` Input
|
||||
|
||||
Pass the tweet's ID from the URL as a parameter to the `tweet` shortcode:
|
||||
Pass the tweet's user (case-insensitive) and id from the URL as parameters to the `tweet` shortcode.
|
||||
|
||||
{{< code file="example-tweet-input.md" >}}
|
||||
{{</* tweet 877500564405444608 */>}}
|
||||
{{</* tweet user="SanDiegoZoo" id="1453110110599868418" */>}}
|
||||
{{< /code >}}
|
||||
|
||||
#### Example `tweet` Output
|
||||
|
@ -326,14 +326,14 @@ Pass the tweet's ID from the URL as a parameter to the `tweet` shortcode:
|
|||
Using the preceding `tweet` example, the following HTML will be added to your rendered website's markup:
|
||||
|
||||
{{< output file="example-tweet-output.html" >}}
|
||||
{{< tweet 877500564405444608 >}}
|
||||
{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
|
||||
{{< /output >}}
|
||||
|
||||
#### Example `tweet` Display
|
||||
|
||||
Using the preceding `tweet` example, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup.
|
||||
|
||||
{{< tweet 877500564405444608 >}}
|
||||
{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
|
||||
|
||||
### `vimeo`
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ go install
|
|||
Hugo relies on [mage](https://github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
|
||||
|
||||
```
|
||||
go get github.com/magefile/mage
|
||||
go install github.com/magefile/mage@latest
|
||||
```
|
||||
|
||||
### Fork the repository
|
||||
|
|
|
@ -20,7 +20,7 @@ aliases: []
|
|||
`.GetPage` returns a page of a given `path`. Both `Site` and `Page` implements this method. The `Page` variant will, if given a relative path -- i.e. a path without a leading `/` -- try look for the page relative to the current page.
|
||||
|
||||
{{% note %}}
|
||||
**Note:** We overhauled and simplified the `.GetPage` API in Hugo 0.45. Before that you needed to provide a `Kind` attribute in addition to the path, e.g. `{{ .Site.GetPage "section" "blog" }}`. This will still work, but is now superflous.
|
||||
**Note:** We overhauled and simplified the `.GetPage` API in Hugo 0.45. Before that you needed to provide a `Kind` attribute in addition to the path, e.g. `{{ .Site.GetPage "section" "blog" }}`. This will still work, but is now superfluous.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ aliases: []
|
|||
{{ with .Site.GetPage "/blog" }}{{ .Title }}{{ end }}
|
||||
```
|
||||
|
||||
This method wil return `nil` when no page could be found, so the above will not print anything if the blog section is not found.
|
||||
This method will return `nil` when no page could be found, so the above will not print anything if the blog section is not found.
|
||||
|
||||
To find a regular page in the blog section::
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ aliases: []
|
|||
|
||||
`dict` is especially useful for passing more than one value to a partial template.
|
||||
|
||||
Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deply nested structure, e.g.:
|
||||
Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deeply nested structure, e.g.:
|
||||
|
||||
```go-text-template
|
||||
{{ $m := dict (slice "a" "b" "c") "value" }}
|
||||
|
|
|
@ -2,27 +2,41 @@
|
|||
title: "fileExists"
|
||||
linktitle: "fileExists"
|
||||
date: 2017-08-31T22:38:22+02:00
|
||||
description: Checks whether a file exists under the given path.
|
||||
description: Checks for file or directory existence.
|
||||
publishdate: 2017-08-31T22:38:22+02:00
|
||||
lastmod: 2017-08-31T22:38:22+02:00
|
||||
lastmod: 2021-11-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
signature: ["fileExists PATH"]
|
||||
signature: ["os.FileExists PATH","fileExists PATH"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
relatedfuncs: ['os.ReadDir','os.ReadFile','os.Stat']
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
The `os.FileExists` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`]({{< relref "getting-started/configuration#contentdir">}}). A leading path separator (`/`) is optional.
|
||||
|
||||
`fileExists` allows you to check if a file exists under a given path, e.g. before inserting code into a template:
|
||||
With this directory structure:
|
||||
|
||||
```
|
||||
{{ if (fileExists "static/img/banner.jpg") -}}
|
||||
<img src="{{ "img/banner.jpg" | absURL }}" />
|
||||
{{- end }}
|
||||
```text
|
||||
content/
|
||||
├── about.md
|
||||
├── contact.md
|
||||
└── news/
|
||||
├── article-1.md
|
||||
└── article-2.md
|
||||
```
|
||||
|
||||
In the example above, a banner from the `static` folder should be shown if the given path points to an existing file.
|
||||
The function returns these values:
|
||||
|
||||
```go-html-template
|
||||
{{ os.FileExists "content" }} --> true
|
||||
{{ os.FileExists "content/news" }} --> true
|
||||
{{ os.FileExists "content/news/article-1" }} --> false
|
||||
{{ os.FileExists "content/news/article-1.md" }} --> true
|
||||
{{ os.FileExists "news" }} --> true
|
||||
{{ os.FileExists "news/article-1" }} --> false
|
||||
{{ os.FileExists "news/article-1.md" }} --> true
|
||||
```
|
||||
|
|
|
@ -1,30 +1,43 @@
|
|||
---
|
||||
title: getenv
|
||||
description: Returns the value of an environment variable.
|
||||
description: Returns the value of an environment variable, or an empty string if the environment variable is not set.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
lastmod: 2021-11-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: []
|
||||
signature: ["getenv VARIABLE"]
|
||||
signature: ["os.Getenv VARIABLE", "getenv VARIABLE"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
Examples:
|
||||
|
||||
Takes a string containing the name of the variable as input. Returns
|
||||
an empty string if the variable is not set, otherwise returns the
|
||||
value of the variable.
|
||||
|
||||
```
|
||||
{{ getenv "HOME" }}
|
||||
```go-html-template
|
||||
{{ os.Getenv "HOME" }} --> /home/victor
|
||||
{{ os.Getenv "USER" }} --> victor
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
In Unix-like environments, the variable must also be exported in order to be seen by `hugo`.
|
||||
{{% /note %}}
|
||||
You can pass values when building your site:
|
||||
|
||||
```bash
|
||||
MY_VAR1=foo MY_VAR2=bar hugo
|
||||
|
||||
OR
|
||||
|
||||
export MY_VAR1=foo
|
||||
export MY_VAR2=bar
|
||||
hugo
|
||||
```
|
||||
|
||||
And then retrieve the values within a template:
|
||||
|
||||
```go-html-template
|
||||
{{ os.Getenv "MY_VAR1" }} --> foo
|
||||
{{ os.Getenv "MY_VAR2" }} --> bar
|
||||
```
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
title: os.Stat
|
||||
description: Gets a file information of a given path.
|
||||
description: Returns a FileInfo structure describing a file or directory.
|
||||
date: 2018-08-07
|
||||
publishdate: 2018-08-07
|
||||
lastmod: 2018-08-07
|
||||
lastmod: 2021-11-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
|
@ -12,21 +12,21 @@ keywords: [files]
|
|||
signature: ["os.Stat PATH"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: [readDir]
|
||||
relatedfuncs: ['os.FileExists','os.ReadDir','os.ReadFile']
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
The `os.Stat` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`]({{< relref "getting-started/configuration#contentdir">}}). A leading path separator (`/`) is optional.
|
||||
|
||||
If your current project working directory has a single file named `README.txt` (30 bytes):
|
||||
```
|
||||
{{ $stat := os.Stat "README.txt" }}
|
||||
{{ $stat.Name }} → "README.txt"
|
||||
{{ $stat.Size }} → 30
|
||||
```go-html-template
|
||||
{{ $f := os.Stat "README.md" }}
|
||||
{{ $f.IsDir }} --> false (bool)
|
||||
{{ $f.ModTime }} --> 2021-11-25 10:06:49.315429236 -0800 PST (time.Time)
|
||||
{{ $f.Name }} --> README.md (string)
|
||||
{{ $f.Size }} --> 241 (int64)
|
||||
|
||||
{{ $d := os.Stat "content" }}
|
||||
{{ $d.IsDir }} --> true (bool)
|
||||
```
|
||||
|
||||
Function [`os.Stat`][Stat] returns [`os.FileInfo`][osfileinfo].
|
||||
For further information of `os.FileInfo`, see [golang page][osfileinfo].
|
||||
|
||||
|
||||
[Stat]: /functions/os.Stat/
|
||||
[osfileinfo]: https://golang.org/pkg/os/#FileInfo
|
||||
Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
|
||||
|
|
26
content/en/functions/path.Clean.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: path.Clean
|
||||
description: Replaces path separators with slashes (`/`) and removes extraneous separators.
|
||||
date: 2021-10-08
|
||||
# publishdate: 2018-11-28
|
||||
# lastmod: 2018-11-28
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [path]
|
||||
signature: ["path.Clean PATH"]
|
||||
---
|
||||
|
||||
`path.Clean` replaces path separators with slashes (`/`) and removes extraneous separators, including trailing separators.
|
||||
|
||||
```
|
||||
{{ path.Clean "foo//bar" }} → "foo/bar"
|
||||
{{ path.Clean "/foo/bar/" }} → "/foo/bar"
|
||||
```
|
||||
|
||||
On a Windows system, if `.File.Path` is `foo\bar.md`, then:
|
||||
|
||||
```
|
||||
{{ path.Clean .File.Path }} → "foo/bar.md"
|
||||
```
|
|
@ -1,28 +1,51 @@
|
|||
---
|
||||
title: readDir
|
||||
description: Gets a directory listing from a directory relative to the current working directory.
|
||||
date: 2017-02-01
|
||||
description: Returns an array of FileInfo structures sorted by filename, one element for each directory entry.
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
lastmod: 2021-11-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [files]
|
||||
signature: ["readDir PATH"]
|
||||
signature: ["os.ReadDir PATH", "readDir PATH"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: [readFile]
|
||||
relatedfuncs: ['os.FileExists','os.ReadFile','os.Stat']
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
The `os.ReadDir` function resolves the path relative to the root of your project directory. A leading path separator (`/`) is optional.
|
||||
|
||||
If your current project working directory has a single file named `README.txt`:
|
||||
With this directory structure:
|
||||
|
||||
```
|
||||
{{ range (readDir ".") }}{{ .Name }}{{ end }} → "README.txt"
|
||||
```text
|
||||
content/
|
||||
├── about.md
|
||||
├── contact.md
|
||||
└── news/
|
||||
├── article-1.md
|
||||
└── article-2.md
|
||||
```
|
||||
|
||||
For more information on using `readDir` and `readFile` in your templates, see [Local File Templates][local].
|
||||
This template code:
|
||||
|
||||
[local]: /templates/files/
|
||||
```go-html-template
|
||||
{{ range os.ReadDir "content" }}
|
||||
{{ .Name }} --> {{ .IsDir }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Produces:
|
||||
|
||||
```html
|
||||
about.md --> false
|
||||
contact.md --> false
|
||||
news --> true
|
||||
```
|
||||
|
||||
Note that `os.ReadDir` is not recursive.
|
||||
|
||||
Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
|
||||
|
||||
For more information on using `readDir` and `readFile` in your templates, see [Local File Templates]({{< relref "/templates/files" >}}).
|
||||
|
|
|
@ -1,32 +1,41 @@
|
|||
---
|
||||
title: readFile
|
||||
description: Reads a file from disk relative to the current project working directory and returns a string.
|
||||
description: Returns the contents of a file.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-04-30
|
||||
lastmod: 2021-11-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
keywords: [files]
|
||||
signature: ["readFile PATH"]
|
||||
signature: ["os.ReadFile PATH", "readFile PATH"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: [readDir]
|
||||
relatedfuncs: ['os.FileExists','os.ReadDir','os.Stat']
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
The `os.ReadFile` function attempts to resolve the path relative to the root of your project directory. If a matching file is not found, it will attempt to resolve the path relative to the [`contentDir`]({{< relref "getting-started/configuration#contentdir">}}). A leading path separator (`/`) is optional.
|
||||
|
||||
Note that the filename must be relative to the current project working directory, or the project's `/content` folder.
|
||||
With a file named README.md in the root of your project directory:
|
||||
|
||||
So, if you have a file with the name `README.txt` in the root of your project with the content `Hugo Rocks!`:
|
||||
|
||||
```
|
||||
{{readFile "README.txt"}} → "Hugo Rocks!"
|
||||
```text
|
||||
This is **bold** text.
|
||||
```
|
||||
|
||||
If you receive a "file doesn't exist" error with a path listed, do take note that the path is the last one checked by the function, and may not accurately reflect your target. You should generally double-check your path for mistakes.
|
||||
This template code:
|
||||
|
||||
For more information on using `readDir` and `readFile` in your templates, see [Local File Templates][local].
|
||||
```go-html-template
|
||||
{{ os.ReadFile "README.md" }}
|
||||
```
|
||||
|
||||
[local]: /templates/files/
|
||||
Produces:
|
||||
|
||||
```html
|
||||
This is **bold** text.
|
||||
```
|
||||
|
||||
Note that `os.ReadFile` returns raw (uninterpreted) content.
|
||||
|
||||
For more information on using `readDir` and `readFile` in your templates, see [Local File Templates]({{< relref "/templates/files" >}}).
|
||||
|
|
|
@ -22,7 +22,7 @@ It normally takes two parameters: `start` and `length`. It can also take one par
|
|||
|
||||
To extract characters from the end of the string, use a negative start number.
|
||||
|
||||
In addition, borrowing from the extended behavior described at https://php.net substr, if `length` is given and is negative, that number of characters will be omitted from the end of string.
|
||||
If `length` is given and is negative, that number of characters will be omitted from the end of string.
|
||||
|
||||
```
|
||||
{{ substr "abcdef" 0 }} → "abcdef"
|
||||
|
|
|
@ -1,35 +1,31 @@
|
|||
---
|
||||
title: .Unix
|
||||
draft: false
|
||||
description: .Unix returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC.
|
||||
description: Converts a time.Time value to the number of seconds elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
keywords: [dates,time]
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
signature: [".Unix"]
|
||||
workson: [times]
|
||||
hugoversion:
|
||||
signature: [".Unix",".UnixMilli",".UnixMicro",".UnixNano"]
|
||||
relatedfuncs: [Format,dateFormat,now,time]
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
## Example: Time Passed Since Last Modification
|
||||
The `Milli`, `Micro`, and `Nano` variants return the number of milliseconds, microseconds, and nanoseconds (respectively) elapsed since the Unix epoch.
|
||||
|
||||
This very simple one-liner uses `now.Unix` to calculate the amount of time that has passed between the `.LastMod` for the current page and the last build of the current page.
|
||||
```go-html-template
|
||||
.Date.Unix --> 1637259694
|
||||
.ExpiryDate.Unix --> 1672559999
|
||||
.Lastmod.Unix --> 1637361786
|
||||
.PublishDate.Unix --> 1637421261
|
||||
|
||||
{{< code file="time-passed.html" >}}
|
||||
{{ div (sub now.Unix .Lastmod.Unix) 86400 }}
|
||||
{{< /code >}}
|
||||
("1970-01-01T00:00:00-00:00" | time.AsTime).Unix --> 0
|
||||
("1970-01-01T00:00:42-00:00" | time.AsTime).Unix --> 42
|
||||
("1970-04-11T01:48:29-08:00" | time.AsTime).Unix --> 8675309
|
||||
("2026-05-02T20:09:31-07:00" | time.AsTime).Unix --> 1777777771
|
||||
|
||||
Since both values are integers, they can be subtracted and then divided by the number of seconds in a day (i.e., `60 * 60 * 24 == 86400`).
|
||||
|
||||
{{% note %}}
|
||||
Hugo's output is *static*. For the example above to be realistic, the site needs to be built every day.
|
||||
{{% /note %}}
|
||||
|
||||
[partial template]: /templates/partials/
|
||||
now.Unix --> 1637447841
|
||||
now.UnixMilli --> 1637447841347
|
||||
now.UnixMicro --> 1637447841347378
|
||||
now.UnixNano --> 1637447841347378799
|
||||
```
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
---
|
||||
title: Code Toggle
|
||||
description: Code Toggle tryout and showcase.
|
||||
date: 2018-03-16
|
||||
categories: [getting started,fundamentals]
|
||||
keywords: [configuration,toml,yaml,json]
|
||||
weight: 60
|
||||
sections_weight: 60
|
||||
draft: false
|
||||
toc: true
|
||||
---
|
||||
|
||||
## The Config Toggler!
|
||||
|
||||
This is an example for the Config Toggle shortcode.
|
||||
Its purpose is to let users choose a Config language by clicking on its corresponding tab. Upon doing so, every Code toggler on the page will be switched to the target language. Also, target language will be saved in user's `localStorage` so when they go to a different pages, Code Toggler display their last "toggled" config language.
|
||||
|
||||
{{% note %}}
|
||||
The `code-toggler` shortcode is not an internal Hugo shortcode. This page's purpose is to test out a custom feature that we use throughout this site. See: https://github.com/gohugoio/gohugoioTheme/blob/master/layouts/shortcodes/code-toggle.html
|
||||
{{% /note %}}
|
||||
|
||||
## That Config Toggler
|
||||
|
||||
{{< code-toggle file="config">}}
|
||||
|
||||
baseURL: "https://yoursite.example.com/"
|
||||
title: "My Hugo Site"
|
||||
footnoteReturnLinkContents: "↩"
|
||||
permalinks:
|
||||
posts: /:year/:month/:title/
|
||||
params:
|
||||
Subtitle: "Hugo is Absurdly Fast!"
|
||||
AuthorName: "Jon Doe"
|
||||
GitHubUser: "spf13"
|
||||
ListOfFoo:
|
||||
- "foo1"
|
||||
- "foo2"
|
||||
SidebarRecentLimit: 5
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Another Config Toggler!
|
||||
|
||||
{{< code-toggle file="theme">}}
|
||||
|
||||
# theme.toml template for a Hugo theme
|
||||
|
||||
name = "Hugo Theme"
|
||||
license = "MIT"
|
||||
licenselink = "https://github.com/budparr/gohugo.io/blob/master/LICENSE.md"
|
||||
description = ""
|
||||
homepage = "https://github.com/budparr/gohugo.io"
|
||||
tags = ["website"]
|
||||
features = ["", ""]
|
||||
min_version = 0.18
|
||||
|
||||
[author]
|
||||
name = "Bud Parr"
|
||||
homepage = "https://github.com/budparr"
|
||||
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Two regular code blocks
|
||||
|
||||
{{< code file="bf-config.toml" >}}
|
||||
[blackfriday]
|
||||
angledQuotes = true
|
||||
fractions = false
|
||||
plainIDAnchors = true
|
||||
extensions = ["hardLineBreak"]
|
||||
{{< /code >}}
|
||||
|
||||
{{< code file="bf-config.yml" >}}
|
||||
blackfriday:
|
||||
angledQuotes: true
|
||||
fractions: false
|
||||
plainIDAnchors: true
|
||||
extensions:
|
||||
- hardLineBreak
|
||||
{{< /code >}}
|
|
@ -166,6 +166,12 @@ Enable to turn relative URLs into absolute.
|
|||
|
||||
The directory from where Hugo reads content files. {{% module-mounts-note %}}
|
||||
|
||||
### copyright
|
||||
|
||||
**Default value:** ""
|
||||
|
||||
Copyright notice for your site, typically displayed in the footer.
|
||||
|
||||
### dataDir
|
||||
|
||||
**Default value:** "data"
|
||||
|
@ -275,6 +281,12 @@ If true, auto-detect Chinese/Japanese/Korean Languages in the content. This will
|
|||
### imaging
|
||||
See [Image Processing Config](/content-management/image-processing/#image-processing-config).
|
||||
|
||||
### languageCode
|
||||
|
||||
**Default value:** ""
|
||||
|
||||
A language tag as defined by [RFC 5646](https://datatracker.ietf.org/doc/html/rfc5646). The internal [RSS template](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml) populates its `<language>` element with this value. The value is not used elsewhere.
|
||||
|
||||
### languages
|
||||
See [Configure Languages](/content-management/multilingual/#configure-languages).
|
||||
|
||||
|
@ -351,6 +363,17 @@ When using `ref` or `relref` to resolve page links and a link cannot resolved, i
|
|||
### refLinksNotFoundURL
|
||||
URL to be used as a placeholder when a page reference cannot be found in `ref` or `relref`. Is used as-is.
|
||||
|
||||
### removePathAccents
|
||||
|
||||
**Default value:** false
|
||||
|
||||
Removes [non-spacing marks](https://www.compart.com/en/unicode/category/Mn) from [composite characters](https://en.wikipedia.org/wiki/Precomposed_character) in content paths.
|
||||
|
||||
```text
|
||||
content/post/hügó.md --> https://example.org/post/hugo/
|
||||
```
|
||||
|
||||
|
||||
### rssLimit
|
||||
|
||||
Maximum number of items in the RSS feed.
|
||||
|
@ -381,9 +404,9 @@ The directory where Hugo reads the themes from.
|
|||
|
||||
### timeout
|
||||
|
||||
**Default value:** 10000
|
||||
**Default value:** "30s"
|
||||
|
||||
Timeout for generating page contents, in milliseconds (defaults to 10 seconds). *Note:* this is used to bail out of recursive content generation, if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents) you might need to raise this limit.
|
||||
Timeout for generating page contents, specified as a [duration](https://pkg.go.dev/time#Duration) or in milliseconds. *Note:* this is used to bail out of recursive content generation. You might need to raise this limit if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents).
|
||||
|
||||
### timeZone
|
||||
|
||||
|
@ -456,7 +479,7 @@ This is only relevant when running `hugo server`, and it allows to set HTTP head
|
|||
{{< code-toggle file="config">}}
|
||||
[server]
|
||||
[[server.headers]]
|
||||
for = "/**.html"
|
||||
for = "/**"
|
||||
|
||||
[server.headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
|
@ -471,7 +494,7 @@ Since this is is "development only", it may make sense to put it below the `deve
|
|||
|
||||
{{< code-toggle file="config/development/server">}}
|
||||
[[headers]]
|
||||
for = "/**.html"
|
||||
for = "/**"
|
||||
|
||||
[headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
|
@ -564,12 +587,18 @@ Test and document setting params via JSON env var.
|
|||
|
||||
## Ignore Content and Data Files when Rendering
|
||||
|
||||
To exclude specific files from the content and data directories when rendering your site, set `ignoreFiles` to one or more regular expressions.
|
||||
To exclude specific files from the `content` and `data` directories when rendering your site, set `ignoreFiles` to one or more regular expressions to match against the absolute file path.
|
||||
|
||||
For example, to ignore content and data files ending with `.foo` and `.boo`:
|
||||
To ignore files ending with `.foo` or `.boo`:
|
||||
|
||||
{{< code-toggle >}}
|
||||
ignoreFiles = [ "\\.foo$","\\.boo$"]
|
||||
{{< code-toggle copy="false" >}}
|
||||
ignoreFiles = ['\.foo$', '\.boo$']
|
||||
{{< /code-toggle >}}
|
||||
|
||||
To ignore a file using the absolute file path:
|
||||
|
||||
{{< code-toggle copy="false" >}}
|
||||
ignoreFiles = ['^/home/user/project/content/test\.md$']
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Configure Front Matter
|
||||
|
|
|
@ -516,6 +516,14 @@ For the latest version, the Hugo package maintained by [@daftaupe](https://githu
|
|||
|
||||
See the [related discussion in the Hugo forums][redhatforum].
|
||||
|
||||
### openSUSE Tumbleweed
|
||||
|
||||
openSUSE maintains an [official package](https://software.opensuse.org/package/hugo) for the Tumbleweed rolling release distribution, it may be installed with:
|
||||
|
||||
````
|
||||
sudo zypper install hugo
|
||||
````
|
||||
|
||||
### Solus
|
||||
|
||||
Solus includes Hugo in its package repository, it may be installed with:
|
||||
|
|
|
@ -86,6 +86,14 @@ jobs:
|
|||
|
||||
For more advanced settings [actions-hugo](https://github.com/marketplace/actions/hugo-setup) and [actions-gh-pages](https://github.com/marketplace/actions/github-pages-action).
|
||||
|
||||
## Github pages setting
|
||||
By default, the GitHub action pushes the generated content to the `gh-pages` branch. This means GitHub has to serve your `gh-pages` branch as a GitHub Pages branch. You can change this setting by going to Settings > GitHub Pages, and change the source branch to `gh-pages`.
|
||||
|
||||
## Change baseURL in config.toml
|
||||
Don't forget to rename your `baseURL` in `config.toml` with the value `https://<USERNAME>.github.io` for your user repository or `https://<USERNAME>.github.io/<REPOSITORY_NAME>` for a project repository.
|
||||
|
||||
Unless this is present in your `config.toml`, your website won't work.
|
||||
|
||||
## 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 requirement of GitHub Pages.
|
||||
|
|
|
@ -6,7 +6,7 @@ date: 2019-06-06
|
|||
publishdate: 2019-06-06
|
||||
lastmod: 2020-01-01
|
||||
categories: [hosting and deployment]
|
||||
keywords: [render,hosting,deployment]
|
||||
keywords: [hosting,deployment]
|
||||
authors: [Anurag Goel]
|
||||
menu:
|
||||
docs:
|
||||
|
|
|
@ -155,3 +155,15 @@ target
|
|||
lang
|
||||
: The language code, e.g. "en". Only relevant for `content` mounts, and `static` mounts when in multihost mode.
|
||||
|
||||
includeFiles (string or slice)
|
||||
: One or more [glob](https://github.com/gobwas/glob) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted.
|
||||
|
||||
The glob patterns are matched to the filenames starting from the `source` root, they should have Unix styled slashes even on Windows, `/` matches the mount root and `**` can be used as a super-asterisk to match recursively down all directories, e.g `/posts/**.jpg`.
|
||||
|
||||
The search is case-insensitive.
|
||||
|
||||
{{< new-in "0.89.0" >}}
|
||||
|
||||
excludeFiles (string or slice)
|
||||
: One or more glob patterns matching files to exclude.
|
||||
|
||||
|
|
|
@ -15,12 +15,10 @@ sections_weight: 40
|
|||
draft: false
|
||||
---
|
||||
|
||||
|
||||
Any asset file can be processed using `resources.PostCSS` which takes for argument the resource object and a slice of options listed below.
|
||||
|
||||
The resource will be processed using the project's or theme's own `postcss.config.js` or any file set with the `config` option.
|
||||
|
||||
|
||||
```go-html-template
|
||||
{{ $css := resources.Get "css/main.css" }}
|
||||
{{ $style := $css | resources.PostCSS }}
|
||||
|
@ -31,6 +29,7 @@ Hugo Pipe's PostCSS requires the `postcss-cli` JavaScript package to be installe
|
|||
|
||||
If you are using the Hugo Snap package, PostCSS and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install postcss-cli` without the `-g` flag.
|
||||
{{% /note %}}
|
||||
|
||||
### Options
|
||||
|
||||
config [string]
|
||||
|
@ -48,7 +47,7 @@ Hugo will look for imports relative to the module mount and will respect theme o
|
|||
_If no configuration file is used:_
|
||||
|
||||
use [string]
|
||||
: List of PostCSS plugins to use
|
||||
: Space-delimited list of PostCSS plugins to use
|
||||
|
||||
parser [string]
|
||||
: Custom PostCSS parser
|
||||
|
@ -60,7 +59,11 @@ syntax [string]
|
|||
: Custom postcss syntax
|
||||
|
||||
```go-html-template
|
||||
{{ $style := resources.Get "css/main.css" | resources.PostCSS (dict "config" "customPostCSS.js" "noMap" true) }}
|
||||
{{ $options := dict "config" "customPostCSS.js" "noMap" true }}
|
||||
{{ $style := resources.Get "css/main.css" | resources.PostCSS $options }}
|
||||
|
||||
{{ $options := dict "use" "autoprefixer postcss-color-alpha" }}
|
||||
{{ $style := resources.Get "css/main.css" | resources.PostCSS $options }}
|
||||
```
|
||||
|
||||
## Check Hugo Environment from postcss.config.js
|
||||
|
|
BIN
content/en/news/0.89.0-relnotes/featured.png
Normal file
After Width: | Height: | Size: 102 KiB |
106
content/en/news/0.89.0-relnotes/index.md
Normal file
|
@ -0,0 +1,106 @@
|
|||
|
||||
---
|
||||
date: 2021-11-02
|
||||
title: "Fine Grained File Filters"
|
||||
description: "Hugo 0.89.0 brings fine grained file filters, archetype rewrite, dependency refresh, and more ..."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
This release is a dependency refresh (the new Goldmark version comes with a lot of bug fixes, as one example), many bug fixes, but also some nice new features:
|
||||
|
||||
We have added the [configuration settings](https://gohugo.io/hugo-modules/configuration/#module-config-mounts) **includeFiles** and **excludeFiles** to the mount configuration. This allows fine grained control over what files to include, and it works for all of Hugo's file systems (including `/static`).
|
||||
|
||||
We have also [reimplemented archetypes](https://github.com/gohugoio/hugo/pull/9045). The old implementation had some issues, mostly related to the context (e.g. name, file paths) passed to the template. This new implementation is using the exact same code path for evaluating the pages as in a regular build. This also makes it more robust and easier to reason about in a multilingual setup. Now, if you are explicit about the target path, Hugo will now always pick the correct mount and language:
|
||||
|
||||
```
|
||||
hugo new content/en/posts/my-first-post.md
|
||||
```
|
||||
|
||||
This release represents **50 contributions by 13 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 [@dependabot[bot]](https://github.com/apps/dependabot), [@jmooring](https://github.com/jmooring), and [@anthonyfok](https://github.com/anthonyfok) for their ongoing contributions.
|
||||
And thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his ongoing work on keeping 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 **23 contributions by 9 contributors**. A special thanks to [@jmooring](https://github.com/jmooring), [@bep](https://github.com/bep), [@coliff](https://github.com/coliff), and [@vipkr](https://github.com/vipkr) for their work on the documentation site.
|
||||
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 54999+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 430+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 413+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
* Hugo now writes an empty file named `.hugo_build.lock` to the root of the project when building (also when doing `hugo new mypost.md` and other commands that requires a build). We recommend you just leave this file alone. Put it in `.gitignore` or similar if you don't want the file in your source repository.
|
||||
* We have updated to ESBuild `v0.13.12`. The release notes for [v0.13.0](https://github.com/evanw/esbuild/releases/tag/v0.13.0) mentions a potential breaking change.
|
||||
* We now only build AMD64 release binaries (see [this issue](https://github.com/gohugoio/hugo/issues/9102)) for the Unix OSes (e.g. NetBSD). If you need, say, a binary for ARM64, you need to build it yourself.
|
||||
* We now build only one release binary/archive for MacOS (see [this issue](https://github.com/gohugoio/hugo/issues/9035)) that works on both Intel and the new Arm M1 systems.
|
||||
* `.File.ContentBaseName` now returns the owning directory name for all bundles (branch an leaf). This is a bug fix, but worth mentioning. See [this issue](https://github.com/gohugoio/hugo/issues/9112).
|
||||
* We have updated the Twitter shortcode to use Twitter's new API. See [this issue](https://github.com/gohugoio/hugo/pull/9106) for details.
|
||||
|
||||
## Enhancements
|
||||
|
||||
### Templates
|
||||
|
||||
* Use configured location when date passed to Format is string [e82cbd74](https://github.com/gohugoio/hugo/commit/e82cbd746fd4b07e40fedacc4247b9cd50ef70e7) [@bep](https://github.com/bep) [#9084](https://github.com/gohugoio/hugo/issues/9084)
|
||||
* Add path.Clean [e55466ce](https://github.com/gohugoio/hugo/commit/e55466ce70363418309d465a0f2aa6c7ada1e51d) [@bradcypert](https://github.com/bradcypert) [#8885](https://github.com/gohugoio/hugo/issues/8885)
|
||||
|
||||
### Other
|
||||
|
||||
* Regen CLI docs [f503b639](https://github.com/gohugoio/hugo/commit/f503b6395707f8e576af734efab83092d62fae37) [@bep](https://github.com/bep)
|
||||
* Make ContentBaseName() return the directory for branch bundles [30aba7fb](https://github.com/gohugoio/hugo/commit/30aba7fb099678363b0a4828936ed28e740e00e2) [@bep](https://github.com/bep) [#9112](https://github.com/gohugoio/hugo/issues/9112)
|
||||
* Update Twitter shortcode oEmbed endpoint [0cc39af6](https://github.com/gohugoio/hugo/commit/0cc39af68232f1a4981aae2e72cf65da762b5768) [@jmooring](https://github.com/jmooring) [#8130](https://github.com/gohugoio/hugo/issues/8130)
|
||||
* bump github.com/evanw/esbuild from 0.13.10 to 0.13.12 [7fa66425](https://github.com/gohugoio/hugo/commit/7fa66425aa0a918b4bf5eb9a21f6e567e0a7e876) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* bump github.com/yuin/goldmark from 1.4.1 to 1.4.2 [69210cfd](https://github.com/gohugoio/hugo/commit/69210cfdf341d1faef23f4e9290d51448dd5e0c6) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* bump github.com/aws/aws-sdk-go from 1.40.8 to 1.41.14 [3339c2bb](https://github.com/gohugoio/hugo/commit/3339c2bb618c29bb3ad442c71fe1542ad7195971) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* bump github.com/getkin/kin-openapi from 0.79.0 to 0.80.0 [03bbdba8](https://github.com/gohugoio/hugo/commit/03bbdba8be19929cb6a14243b690372fbfbc6aa6) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* bump github.com/evanw/esbuild from 0.13.8 to 0.13.10 [a772b8fc](https://github.com/gohugoio/hugo/commit/a772b8fc3833e010553c412dd5daa0175e6ccead) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* Rename excepted filenames for image golden testdata [dce49d13](https://github.com/gohugoio/hugo/commit/dce49d13336f3dbadaa1359322a277ad4cb55679) [@anthonyfok](https://github.com/anthonyfok) [#6387](https://github.com/gohugoio/hugo/issues/6387)
|
||||
* bump github.com/frankban/quicktest from 1.13.1 to 1.14.0 [61c5b7a2](https://github.com/gohugoio/hugo/commit/61c5b7a2e623255be99da7adf200f0591c9a1195) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* Validate the target path in hugo new [75c9b893](https://github.com/gohugoio/hugo/commit/75c9b893d98961a504cff9ed3c89055d16e315d6) [@bep](https://github.com/bep) [#9072](https://github.com/gohugoio/hugo/issues/9072)
|
||||
* Set zone of datetime from from `go-toml` [b959ecbc](https://github.com/gohugoio/hugo/commit/b959ecbc8175e2bf260f10b08965531bce9bcb7e) [@satotake](https://github.com/satotake) [#8895](https://github.com/gohugoio/hugo/issues/8895)
|
||||
* Added nodesource apt repository to snap package [70e45481](https://github.com/gohugoio/hugo/commit/70e454812ef684d02ffa881becf0f8ce6a1b5f8c) [@sergiogarciadev](https://github.com/sergiogarciadev)
|
||||
* Set HUGO_ENABLEGITINFO=false override in Set_in_string [355ff83e](https://github.com/gohugoio/hugo/commit/355ff83e74f6e27c79033b8dfb899e3a3b529049) [@anthonyfok](https://github.com/anthonyfok)
|
||||
* Add includeFiles and excludeFiles to mount configuration [471ed91c](https://github.com/gohugoio/hugo/commit/471ed91c60cd36645794925cb4892cc820eae626) [@bep](https://github.com/bep) [#9042](https://github.com/gohugoio/hugo/issues/9042)
|
||||
* bump github.com/mitchellh/mapstructure from 1.4.1 to 1.4.2 [94a5bac5](https://github.com/gohugoio/hugo/commit/94a5bac5b29bbba1ca4809752fe3fd04a58547b6) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* Always preserve the original transform error [9830ca9e](https://github.com/gohugoio/hugo/commit/9830ca9e319f6ce313f4e542a202bd0d0469a9ed) [@bep](https://github.com/bep)
|
||||
* Add hyperlink to the banner [b64fd057](https://github.com/gohugoio/hugo/commit/b64fd0577b0fb222bea22ae347acb5dd17b2aa04) [@itsAftabAlam](https://github.com/itsAftabAlam)
|
||||
* bump github.com/getkin/kin-openapi from 0.78.0 to 0.79.0 [2706437a](https://github.com/gohugoio/hugo/commit/2706437a7d593b66b0fbad0235dbaf917593971b) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* github.com/evanw/esbuild v0.13.5 => v0.13.8 [ec7c993c](https://github.com/gohugoio/hugo/commit/ec7c993cfe216b8a3c6fbac85669cefef59778dd) [@bep](https://github.com/bep)
|
||||
* Return error on no content dirs [32c6f656](https://github.com/gohugoio/hugo/commit/32c6f656d93ecf4308f7c30848b13b4c6f157436) [@bep](https://github.com/bep) [#9056](https://github.com/gohugoio/hugo/issues/9056)
|
||||
* Add a cross process build lock and use it in the archetype content builder [ba35e698](https://github.com/gohugoio/hugo/commit/ba35e69856900b6fc92681aa841cdcaefbb4b121) [@bep](https://github.com/bep) [#9048](https://github.com/gohugoio/hugo/issues/9048)
|
||||
* github.com/alecthomas/chroma v0.9.2 => v0.9.4 [bb053770](https://github.com/gohugoio/hugo/commit/bb053770337e214f41bc1c524d458ba7fbe1fc08) [@bep](https://github.com/bep) [#8532](https://github.com/gohugoio/hugo/issues/8532)
|
||||
* Reimplement archetypes [9185e11e](https://github.com/gohugoio/hugo/commit/9185e11effa682ea1ef7dc98f2943743671023a6) [@bep](https://github.com/bep) [#9032](https://github.com/gohugoio/hugo/issues/9032)[#7589](https://github.com/gohugoio/hugo/issues/7589)[#9043](https://github.com/gohugoio/hugo/issues/9043)[#9046](https://github.com/gohugoio/hugo/issues/9046)[#9047](https://github.com/gohugoio/hugo/issues/9047)
|
||||
* bump github.com/tdewolff/minify/v2 from 2.9.21 to 2.9.22 [168a3aab](https://github.com/gohugoio/hugo/commit/168a3aab4622786ccd0943137fce3912707f2a46) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* Update github.com/evanw/esbuild v0.13.5 [8bcfa3bd](https://github.com/gohugoio/hugo/commit/8bcfa3bdf65492329da8093d841dd04c7a5a10c8) [@bep](https://github.com/bep)
|
||||
* bump github.com/mattn/go-isatty from 0.0.13 to 0.0.14 [cd4e67af](https://github.com/gohugoio/hugo/commit/cd4e67af182a1b3aa19db7609c7581c424e9310f) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* bump github.com/getkin/kin-openapi from 0.75.0 to 0.78.0 [e6ad1f0e](https://github.com/gohugoio/hugo/commit/e6ad1f0e763ee891bf4d71df0168b6949369c793) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* Allow multiple plugins in the PostCSS options map [64abc83f](https://github.com/gohugoio/hugo/commit/64abc83fc4b70c70458c582ae2cf67fc9c67bb3f) [@jmooring](https://github.com/jmooring) [#9015](https://github.com/gohugoio/hugo/issues/9015)
|
||||
* Create path.Clean documentation [f8d132d7](https://github.com/gohugoio/hugo/commit/f8d132d731cf8e27c8c17931597fd975e8a7c3cc) [@jmooring](https://github.com/jmooring)
|
||||
* Skip a test assertion on CI [26f1919a](https://github.com/gohugoio/hugo/commit/26f1919ae0cf57d754bb029270c20e76cc32cf4d) [@bep](https://github.com/bep)
|
||||
* Remove tracking image [ecf025f0](https://github.com/gohugoio/hugo/commit/ecf025f006f22061728e78f2cf50257dde2225ee) [@kambojshalabh35](https://github.com/kambojshalabh35)
|
||||
* Revert "Remove credit from release notes" [fab1e43d](https://github.com/gohugoio/hugo/commit/fab1e43de59f3a7596ab23347387d846139bc3a3) [@digitalcraftsman](https://github.com/digitalcraftsman)
|
||||
* Pass minification errors to the user [e03f82ee](https://github.com/gohugoio/hugo/commit/e03f82eef2679ec8963894d0b911363eef40941a) [@ptgott](https://github.com/ptgott) [#8954](https://github.com/gohugoio/hugo/issues/8954)
|
||||
* Clarify "precision" in currency format functions [a864ffe9](https://github.com/gohugoio/hugo/commit/a864ffe9acf295034bb38e789a0efa62906b2ae4) [@ptgott](https://github.com/ptgott)
|
||||
* bump github.com/evanw/esbuild from 0.12.24 to 0.12.29 [b49da332](https://github.com/gohugoio/hugo/commit/b49da33280cb01795ce833e70c2b7b78cca1867e) [@dependabot[bot]](https://github.com/apps/dependabot)
|
||||
* Use default math/rand.Source for concurrency safety [7c21eca7](https://github.com/gohugoio/hugo/commit/7c21eca74f95b61d6813d0c0b155bf07c9aa8575) [@odeke-em](https://github.com/odeke-em) [#8981](https://github.com/gohugoio/hugo/issues/8981)
|
||||
* Make the error handling for the mod commands more lenient [13ad8408](https://github.com/gohugoio/hugo/commit/13ad8408fc6b645b12898fb8053388fc4848dfbd) [@bep](https://github.com/bep)
|
||||
* Add some help text to the 'unknown revision' error [1cabf61d](https://github.com/gohugoio/hugo/commit/1cabf61ddf96b89c95c3ba77a985168184920feb) [@bep](https://github.com/bep) [#6825](https://github.com/gohugoio/hugo/issues/6825)
|
||||
* Update github.com/yuin/goldmark v1.4.0 => v1.4.1 [268e3069](https://github.com/gohugoio/hugo/commit/268e3069f37df01a5a58b615844652fb75b8503a) [@jmooring](https://github.com/jmooring) [#8855](https://github.com/gohugoio/hugo/issues/8855)
|
||||
|
||||
## Fixes
|
||||
|
||||
### Templates
|
||||
|
||||
* Fix time.Format with Go layouts [ed6fd26c](https://github.com/gohugoio/hugo/commit/ed6fd26ce884c49b02497728a99e90b92dd65f1f) [@bep](https://github.com/bep) [#9107](https://github.com/gohugoio/hugo/issues/9107)
|
||||
|
||||
### Other
|
||||
|
||||
* Fix description of lang.FormatNumberCustom [04a3b45d](https://github.com/gohugoio/hugo/commit/04a3b45db4cd28b4821b5c98cd67dfbf1d098957) [@jmooring](https://github.com/jmooring)
|
||||
* Fix typo in error message [1d60bd1e](https://github.com/gohugoio/hugo/commit/1d60bd1efa943349636edad3dd8c5427312ab0f1) [@jmooring](https://github.com/jmooring)
|
||||
* Fix panic when specifying multiple excludeFiles directives [64e1613f](https://github.com/gohugoio/hugo/commit/64e1613fb390bd893900dc0596e5c3f3c8e1cd8c) [@bep](https://github.com/bep) [#9076](https://github.com/gohugoio/hugo/issues/9076)
|
||||
* Fix file permissions in new archetype implementation [e02e0727](https://github.com/gohugoio/hugo/commit/e02e0727e57f123f9a8de506e9c098bb374f7a23) [@bep](https://github.com/bep) [#9057](https://github.com/gohugoio/hugo/issues/9057)
|
||||
* Fix the "page picker" logic in --navigateToChanged [096f5e19](https://github.com/gohugoio/hugo/commit/096f5e19217e985bccbf6c539e1b220541ffa6f6) [@bep](https://github.com/bep) [#9051](https://github.com/gohugoio/hugo/issues/9051)
|
||||
* Fix a typo on OpenBSD [c7957c90](https://github.com/gohugoio/hugo/commit/c7957c90e83ff2b2cc958bd61486a244f0fd8891) [@nabbisen](https://github.com/nabbisen)
|
||||
* Fix value of useResourceCacheWhen in TestResourceChainPostCSS [e6e44b7c](https://github.com/gohugoio/hugo/commit/e6e44b7c41a9b517ffc3775ea0a6aec2b1d4591b) [@jmooring](https://github.com/jmooring)
|
20
content/en/news/0.89.1-relnotes/index.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
---
|
||||
date: 2021-11-05
|
||||
title: "Hugo 0.89.1: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.89.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with a couple of important fixes.
|
||||
|
||||
* create: Make sure the build lock is released before we open editor [166862a0](https://github.com/gohugoio/hugo/commit/166862a096e1d920f46b18c600e8dadcb478b839) [@bep](https://github.com/bep) [#9121](https://github.com/gohugoio/hugo/issues/9121)
|
||||
* readme: Update dependency list [82c33c71](https://github.com/gohugoio/hugo/commit/82c33c7105a4d0c0e097f0d074c02995cb2b4d20) [@deining](https://github.com/deining)
|
||||
|
||||
|
||||
|
20
content/en/news/0.89.2-relnotes/index.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
---
|
||||
date: 2021-11-08
|
||||
title: "Hugo 0.89.2: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.89.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with a couple of important fixes.
|
||||
|
||||
* Fix path resolution in hugo new [2b01c85d](https://github.com/gohugoio/hugo/commit/2b01c85d14102353015cf6860d30be3d92964495) [@bep](https://github.com/bep) [#9129](https://github.com/gohugoio/hugo/issues/9129)
|
||||
* deps: Upgrade github.com/yuin/goldmark v1.4.2 => v1.4.3 [c09f5c5f](https://github.com/gohugoio/hugo/commit/c09f5c5fd35c03de0444928ada3ce1c5a214b321) [@bep](https://github.com/bep) [#9137](https://github.com/gohugoio/hugo/issues/9137)
|
||||
|
||||
|
||||
|
26
content/en/news/0.89.3-relnotes/index.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
---
|
||||
date: 2021-11-15
|
||||
title: "Hugo 0.89.3: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.89.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with a couple of important fixes.
|
||||
|
||||
* Improve error when we cannot determine content directory in "hugo new" [b8155452](https://github.com/gohugoio/hugo/commit/b8155452ac699473b6b2a34f53988dee01b4da34) [@bep](https://github.com/bep) [#9166](https://github.com/gohugoio/hugo/issues/9166)
|
||||
* deps: Upgrade github.com/yuin/goldmark v1.4.3 => v1.4.4 [08552a7a](https://github.com/gohugoio/hugo/commit/08552a7a4cd1fe64efdd2f1b95142fa4295cb298) [@jmooring](https://github.com/jmooring) [#9159](https://github.com/gohugoio/hugo/issues/9159)
|
||||
* commands: Make sure pollInterval is always set [fdad91fd](https://github.com/gohugoio/hugo/commit/fdad91fd96bc4636bf3a957cdddce18b66473124) [@bep](https://github.com/bep) [#9165](https://github.com/gohugoio/hugo/issues/9165)
|
||||
* create: Improve archetype directory discovery and tests [5f3f6089](https://github.com/gohugoio/hugo/commit/5f3f60898cfe1c087841ec1fbd5ddc2916d0a2c6) [@bep](https://github.com/bep) [#9146](https://github.com/gohugoio/hugo/issues/9146)
|
||||
* create: Add a log statement when archetype is a directory [057d02de](https://github.com/gohugoio/hugo/commit/057d02de256a3866b7044abaa4d03c69d9fedef0) [@bep](https://github.com/bep) [#9157](https://github.com/gohugoio/hugo/issues/9157)
|
||||
* create: Always print "Content ... created" [43ac59da](https://github.com/gohugoio/hugo/commit/43ac59da850901cc848b35129ca7223f9f9a9b19) [@bep](https://github.com/bep) [#9157](https://github.com/gohugoio/hugo/issues/9157)
|
||||
* commands: Fix missing file locking in server partial render [ab5c6990](https://github.com/gohugoio/hugo/commit/ab5c6990a55cbb11d97f857b4619b83fddda3d18) [@bep](https://github.com/bep) [#9162](https://github.com/gohugoio/hugo/issues/9162)
|
||||
* modules: Improve error message [9369d13e](https://github.com/gohugoio/hugo/commit/9369d13e59ffac262944477fad3dcd2742d66288) [@davidsneighbour](https://github.com/davidsneighbour)
|
||||
|
||||
|
||||
|
19
content/en/news/0.89.4-relnotes/index.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
---
|
||||
date: 2021-11-17
|
||||
title: "Hugo 0.89.4: One Bug Fix"
|
||||
description: "This version fixes one bug introduced in 0.89.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This is a bug-fix release with one important fix for people using `hugo new` to create new content:
|
||||
|
||||
* Fix content dir resolution when main project is a Hugo Module [2e70f61f](https://github.com/gohugoio/hugo/commit/2e70f61fb04cea08ef6598728a57637ae2cc199c) [@bep](https://github.com/bep) [#9177](https://github.com/gohugoio/hugo/issues/9177)
|
||||
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
[**Aether**](https://getaether.net) is an open-source peer-to-peer network that hosts self-moderating online-communities.
|
||||
|
||||
[**Aether Pro**](https://aether.app), based on Aether, is a collaboration tool for remote-friendly companies.
|
||||
|
||||
The site is built by:
|
||||
|
||||
* [Burak Nehbit](https://twitter.com/nehbit)
|
||||
|
Before Width: | Height: | Size: 269 KiB |
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
|
||||
title: Aether
|
||||
date: 2020-02-26
|
||||
description: "Showcase: \"Hugo is not just a static site generator for us, it's the core framework at the heart of our entire web front-end.\""
|
||||
|
||||
# The URL to the site on the internet.
|
||||
siteURL: https://getaether.net
|
||||
|
||||
# Add credit to the article author. Leave blank or remove if not needed/wanted.
|
||||
byline: "[Burak Nehbit](https://twitter.com/nehbit), Maintainer, Aether"
|
||||
|
||||
---
|
||||
|
||||
To say that this website, our main online presence, needed to do a lot would be an understatement.
|
||||
|
||||
Our site is home to both *Aether* and *Aether Pro*, our **knowledgebase for each product**, a **server for static assets that we use in our emails**, the **interactive sign-up flows**, **payments client**, **downloads provider**, and even a **mechanism for delivering auto-update notifications** to our native clients. We are using a single Hugo site for all these — it's not a static site generator for us, it's the core framework at the heart of our *entire* web front-end.
|
||||
|
||||
Not only that, this had to work with one developer crunched for time who spends most of his time working on two separate apps across 3 desktop platforms — someone whose main job is very far from building static websites. We only had scraps of time to design and build this Hugo site, make it performant and scalable, and Hugo did a phenomenal job delivering on that promise.
|
||||
|
||||
The last piece is, funnily enough, moving our blog to Hugo, which it is not as of now. This was an inherited mistake we are currently rectifying. Soon, our entire web footprint will be living in Hugo.
|
||||
|
||||
### Structure
|
||||
|
||||
Our website is built in such a way that there is a separate Vue.js instance for each of the contexts since we are not using JS-based single-page navigation. We use Hugo for navigation and to build most pages. For the pages we need to make interactive, we use Vue.js to build individual, self-contained single-page Javascript apps. One such example is our sign-up flow at [aether.app](https://aether.app), an individual Vue app living within a Hugo page, with its own JS-based navigation.
|
||||
|
||||
This is a relatively complex setup, and somewhat out of the ordinary. Yet, even with this custom setup, using Hugo was painless.
|
||||
|
||||
### Tools
|
||||
|
||||
**CMS**: Hugo
|
||||
|
||||
**Theme**: Custom-designed
|
||||
|
||||
**Hosting**: Netlify, pushed to production via `git push`.
|
||||
|
||||
**Javascript runtime**: Vue.js
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
[Camping Arolla](https://www.camping-arolla.com) is located in the heart of the Swiss Alps, at an altitude of 1.950 meters.
|
||||
|
||||
The site is built by:
|
||||
|
||||
* [Didier Divinerites](https://github.com/divinerites)
|
Before Width: | Height: | Size: 441 KiB |
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
|
||||
title: Cocoon & Cosy
|
||||
date: 2018-08-10
|
||||
description: "Showcase: \"Emergency setup a dedicated site in an afternoon.\""
|
||||
siteURL: https://www.cocoon-arolla.com
|
||||
byline: "[Didier Divinerites](https://github.com/divinerites)"
|
||||
|
||||
---
|
||||
|
||||
Swiss [Arolla campsite](https://www.camping-arolla.com) runs the highest campsite in Europe and I'm completely re-doing their actual Website with Hugo.
|
||||
|
||||
But they just launch a brand new offer (luxury tents with bed and fire oven), and we couldn't wait for the proper new website for having this promoted: we needed the website up and running within 24h!
|
||||
|
||||
So we decided to quickly launch a dedicated [independent web site](https://www.cocoon-arolla.com) using all the powerful tools included with [gohugo.io](https://gohugo.io) and some things we already knew & used:
|
||||
|
||||
- Choose a spectacular landing theme in the rich [Hugo Themes](https://themes.gohugo.io/) collection : [Airspace Theme](https://themes.gohugo.io/airspace-hugo/) by Themefisher.
|
||||
- Replace the main images.
|
||||
- Add a [hugo-easy-gallery / photoswipe](https://github.com/liwenyip/hugo-easy-gallery) on the main page with attractive images.
|
||||
- Add the promo video with a simple *vimeo* shortcode.
|
||||
- Replace the Google Maps widget by the [OpenStreetMap](https://www.openstreetmap.org/) equivalent
|
||||
- Use a [Zotabox](https://www.zotabox.com) contact form.
|
||||
- Write the content in French & in English directly on the content pages, describe their services, add fun facts and true testimonies.
|
||||
- Setup a GDPR compliant site with the new Hugo options.
|
||||
- Use [Netlify](https://www.netlify.com) for publishing it in a breeze.
|
||||
|
||||
The first version was up in 4 hours, and the polished 2 languages version was published on Netlify the next day.
|
||||
|
||||
This would have been impossible to do it in such a short time without all the powerful Hugo tools and Netlify simplicity.
|
|
@ -9,7 +9,7 @@ byline: "[bep](https://github.com/bep), Hugo Lead"
|
|||
|
||||
The **Let’s Encrypt website** has a common set of elements: A landing page and some other static info-pages, a document section, a blog, and a documentation section. Having it moved to Hugo was mostly motivated by a _simpler administration and Hugo's [multilingual support](/content-management/multilingual/)_. They already serve HTTPS to more than 60 million domains, and having the documentation available in more languages will increase that reach.[^1]
|
||||
|
||||
{{< tweet 971755920639307777 >}}
|
||||
{{< tweet user="letsencrypt" id="971755920639307777" >}}
|
||||
|
||||
I helped them port the site from Jekyll to Hugo. There are usually very few surprises doing this. I know Hugo very well, but working on sites with a history usually comes up with something new.
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
Pace was started in 2016 to give hotels the super-power to always have the right price.
|
||||
|
||||
We've been using **Hugo+Gulp** from the very beginning and the workflow is proving to scale incredibly well with us as we grow the team and business.
|
Before Width: | Height: | Size: 292 KiB |
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
|
||||
title: Pace Revenue Management
|
||||
|
||||
date: 2018-02-08
|
||||
|
||||
description: "Showcase: \"When we came across Hugo we were blown away.\""
|
||||
|
||||
siteURL: https://www.paceup.com/
|
||||
|
||||
# Link to the site's Hugo source code if public and you can/want to share.
|
||||
# Remove or leave blank if not needed/wanted.
|
||||
|
||||
# Add credit to the article author. Leave blank or remove if not needed/wanted.
|
||||
|
||||
---
|
||||
|
||||
From the beginning, at Pace, we were focused on solving customer needs and didn't want to over-engineer our marketing or sales. At the same time we didn't want to lock ourselves into a WordPress, Squarespace or the like.
|
||||
|
||||
The ideal was a fast, simple, static site builder. When we came across Hugo we were blown away. Being a European company we wanted to be multi-lingual from the get-go and allow multiple team-members to collaborate and own their content. We also felt that a tech-company in 2018 should be capable of hosting its own blog in a simple way.
|
||||
|
||||
Here was Hugo, that allowed us to completely separate content from layout. Our sales-team edit a markdown-file, the engineers commit and off we go -- immediately deployable or pre-viewable.
|
||||
|
||||
The only other way to have all that Hugo offers is to go down the full rabbit-hole of building your own server-side React or some such. Possibly Jekyll but again very complex to work with. The alternatives come with too much work for what should be quite simple.
|
||||
|
||||
**Hugo + Gulp + Netlify for the win! Don't over engineer your web presence!**
|
||||
|
||||
Huge thanks to [@bep](https://github.com/bep) and [community](https://discourse.gohugo.io/) for Hugo.
|
|
@ -69,7 +69,7 @@ Hugo also ships with an internal template for [Disqus comments][disqus], a popul
|
|||
To use Hugo's Disqus template, you first need to set a single configuration value:
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
disqusShortname = "yourdiscussshortname"
|
||||
disqusShortname = "your-disqus-shortname"
|
||||
{{</ code-toggle >}}
|
||||
|
||||
You also have the option to set the following in the front matter for a given piece of content:
|
||||
|
@ -209,7 +209,6 @@ To add Twitter card metadata, include the following line between the `<head>` ta
|
|||
## The Internal Templates
|
||||
|
||||
* `_internal/disqus.html`
|
||||
* `_internal/google_news.html`
|
||||
* `_internal/google_analytics.html`
|
||||
* `_internal/google_analytics_async.html`
|
||||
* `_internal/opengraph.html`
|
||||
|
|
|
@ -151,7 +151,7 @@ Go Templates only ship with a few basic functions but also provide a mechanism f
|
|||
<!-- prints true (i.e., since 1 is less than 2) -->
|
||||
```
|
||||
|
||||
Note that both examples make use of Go Template's [math functions][].
|
||||
Note that both examples make use of Go Template's [math]][] functions.
|
||||
|
||||
{{% note "Additional Boolean Operators" %}}
|
||||
There are more boolean operators than those listed in the Hugo docs in the [Go Template documentation](https://golang.org/pkg/text/template/#hdr-Functions).
|
||||
|
@ -184,7 +184,7 @@ Example of including a `layouts/partials/header.html` partial:
|
|||
|
||||
The `template` function was used to include *partial* templates
|
||||
in much older Hugo versions. Now it's useful only for calling
|
||||
[*internal* templates][internal_templates]. The syntax is `{{ template
|
||||
[*internal* templates][internal templates]. The syntax is `{{ template
|
||||
"_internal/<TEMPLATE>.<EXTENSION>" . }}`.
|
||||
|
||||
{{% note %}}
|
||||
|
@ -630,48 +630,69 @@ Finally, you can pull "magic constants" out of your layouts as well. The followi
|
|||
</nav>
|
||||
```
|
||||
|
||||
## Example: Show Only Upcoming Events
|
||||
## Example: Show Future Events
|
||||
|
||||
Go allows you to do more than what's shown here. Using Hugo's [`where` function][where] and Go built-ins, we can list only the items from `content/events/` whose date (set in a content file's [front matter][]) is in the future. The following is an example [partial template][partials]:
|
||||
Given the following content structure and [front matter]:
|
||||
|
||||
{{< code file="layouts/partials/upcoming-events.html" download="upcoming-events.html" >}}
|
||||
<h4>Upcoming Events</h4>
|
||||
<ul class="upcoming-events">
|
||||
{{ range where .Pages.ByDate "Section" "events" }}
|
||||
{{ if ge .Date.Unix now.Unix }}
|
||||
```text
|
||||
content/
|
||||
└── events/
|
||||
├── event-1.md
|
||||
├── event-2.md
|
||||
└── event-3.md
|
||||
```
|
||||
|
||||
{{< code-toggle file="content/events/event-1.md" copy="false" >}}
|
||||
title = 'Event 1'
|
||||
date = 2021-12-06T10:37:16-08:00
|
||||
draft = false
|
||||
start_date = 2021-12-05T09:00:00-08:00
|
||||
end_date = 2021-12-05T11:00:00-08:00
|
||||
{{< /code-toggle >}}
|
||||
|
||||
This [partial template][partials] renders future events:
|
||||
|
||||
{{< code file="layouts/partials/future-events.html" >}}
|
||||
<h2>Future Events</h2>
|
||||
<ul>
|
||||
{{ range where site.RegularPages "Type" "events" }}
|
||||
{{ if gt (.Params.start_date | time.AsTime) now }}
|
||||
{{ $startDate := .Params.start_date | time.Format ":date_medium" }}
|
||||
<li>
|
||||
<!-- add span for event type -->
|
||||
<span>{{ .Type | title }} —</span>
|
||||
{{ .Title }} on
|
||||
<!-- add span for event date -->
|
||||
<span>{{ .Date.Format "2 January at 3:04pm" }}</span>
|
||||
at {{ .Params.place }}
|
||||
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> - {{ $startDate }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{< /code >}}
|
||||
|
||||
If you restrict front matter to the TOML format, and omit quotation marks surrounding date fields, you can perform date comparisons without casting.
|
||||
|
||||
[`where` function]: /functions/where/
|
||||
[config]: /getting-started/configuration/
|
||||
{{< code file="layouts/partials/future-events.html" >}}
|
||||
<h2>Future Events</h2>
|
||||
<ul>
|
||||
{{ range where (where site.RegularPages "Type" "events") "Params.start_date" "gt" now }}
|
||||
{{ $startDate := .Params.start_date | time.Format ":date_medium" }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> - {{ $startDate }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{< /code >}}
|
||||
|
||||
[config]: {{< relref "getting-started/configuration" >}}
|
||||
[dotdoc]: https://golang.org/pkg/text/template/#hdr-Variables
|
||||
[first]: /functions/first/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[functions]: /functions/ "See the full list of Hugo's templating functions with a quick start reference guide and basic and advanced examples."
|
||||
[Go html/template]: https://golang.org/pkg/html/template/ "Godocs references for Go's html templating"
|
||||
[gohtmltemplate]: https://golang.org/pkg/html/template/ "Godocs references for Go's html templating"
|
||||
[index]: /functions/index-function/
|
||||
[math functions]: /functions/math/
|
||||
[partials]: /templates/partials/ "Link to the partial templates page inside of the templating section of the Hugo docs"
|
||||
[internal_templates]: /templates/internal/
|
||||
[relpermalink]: /variables/page/
|
||||
[safehtml]: /functions/safehtml/
|
||||
[sitevars]: /variables/site/
|
||||
[pagevars]: /variables/page/
|
||||
[variables]: /variables/ "See the full extent of page-, site-, and other variables that Hugo make available to you in your templates."
|
||||
[where]: /functions/where/
|
||||
[with]: /functions/with/
|
||||
[godocsindex]: https://golang.org/pkg/text/template/ "Godocs page for index function"
|
||||
[param]: /functions/param/
|
||||
[isset]: /functions/isset/
|
||||
[first]: {{< relref "functions/first" >}}
|
||||
[front matter]: {{< relref "content-management/front-matter" >}}
|
||||
[functions]: {{< relref "functions" >}}
|
||||
[internal templates]: {{< relref "templates/internal" >}}
|
||||
[isset]: {{< relref "functions/isset" >}}
|
||||
[math]: {{< relref "functions/math" >}}
|
||||
[pagevars]: {{< relref "variables/page" >}}
|
||||
[param]: {{< relref "functions/param" >}}
|
||||
[partials]: {{< relref "templates/partials" >}}
|
||||
[relpermalink]: {{< relref "variables/page#page-variables" >}}
|
||||
[safehtml]: {{< relref "functions/safehtml" >}}
|
||||
[sitevars]: {{< relref "variables/site" >}}
|
||||
[variables]: {{< relref "variables" >}}
|
||||
[with]: {{< relref "functions/with" >}}
|
||||
|
|
|
@ -37,7 +37,7 @@ How to automate the "publish at intervals" part depends on your situation:
|
|||
|
||||
Also see this Twitter thread:
|
||||
|
||||
{{< tweet 962380712027590657 >}}
|
||||
{{< tweet user="ChrisShort" id="962380712027590657" >}}
|
||||
|
||||
[^date-hierarchy]: See [Configure Dates](https://gohugo.io/getting-started/configuration/#configure-dates) for the order in which the different date variables are complemented by each other when not explicitly set.
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ All the methods below, e.g. `.Site.RegularPages` can also be reached via the glo
|
|||
: indicates the language currently being used to render the website. This object's attributes are set in site configurations' language definition.
|
||||
|
||||
.Site.LanguageCode
|
||||
: a string representing the language as defined in the site configuration. This is mostly used to populate the RSS feeds with the right language code.
|
||||
: a string representing the language tag as defined in the site configuration.
|
||||
|
||||
.Site.LanguagePrefix
|
||||
: this can be used to prefix URLs to point to the correct language. It will even work when only one defined language. See also the functions [absLangURL](/functions/abslangurl/) and [relLangURL](/functions/rellangurl).
|
||||
|
|
|
@ -87,6 +87,14 @@
|
|||
"ino"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "ArmAsm",
|
||||
"Aliases": [
|
||||
"S",
|
||||
"armasm",
|
||||
"s"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Awk",
|
||||
"Aliases": [
|
||||
|
@ -133,6 +141,15 @@
|
|||
"zshrc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "BashSession",
|
||||
"Aliases": [
|
||||
"bash-session",
|
||||
"console",
|
||||
"sh-session",
|
||||
"shell-session"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Batchfile",
|
||||
"Aliases": [
|
||||
|
@ -436,6 +453,13 @@
|
|||
"factor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Fennel",
|
||||
"Aliases": [
|
||||
"fennel",
|
||||
"fnl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Fish",
|
||||
"Aliases": [
|
||||
|
@ -802,6 +826,15 @@
|
|||
"mcfunction"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Meson",
|
||||
"Aliases": [
|
||||
"build",
|
||||
"meson",
|
||||
"meson.build",
|
||||
"txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Metal",
|
||||
"Aliases": [
|
||||
|
@ -925,6 +958,19 @@
|
|||
"octave"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OnesEnterprise",
|
||||
"Aliases": [
|
||||
"1S",
|
||||
"1S:Enterprise",
|
||||
"EPF",
|
||||
"ERF",
|
||||
"epf",
|
||||
"erf",
|
||||
"ones",
|
||||
"onesenterprise"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OpenSCAD",
|
||||
"Aliases": [
|
||||
|
@ -1269,6 +1315,13 @@
|
|||
"scss"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Sieve",
|
||||
"Aliases": [
|
||||
"sieve",
|
||||
"siv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Smalltalk",
|
||||
"Aliases": [
|
||||
|
@ -3903,7 +3956,7 @@
|
|||
},
|
||||
"lang": {
|
||||
"FormatAccounting": {
|
||||
"Description": "FormatAccounting returns the currency reprecentation of number for the given currency and precision\nfor the current language in accounting notation.",
|
||||
"Description": "FormatAccounting returns the currency representation of number for the given currency and precision\nfor the current language in accounting notation.\n\nThe return value is formatted with at least two decimal places.",
|
||||
"Args": [
|
||||
"precision",
|
||||
"currency",
|
||||
|
@ -3918,7 +3971,7 @@
|
|||
]
|
||||
},
|
||||
"FormatCurrency": {
|
||||
"Description": "FormatCurrency returns the currency reprecentation of number for the given currency and precision\nfor the current language.",
|
||||
"Description": "FormatCurrency returns the currency representation of number for the given currency and precision\nfor the current language.\n\nThe return value is formatted with at least two decimal places.",
|
||||
"Args": [
|
||||
"precision",
|
||||
"currency",
|
||||
|
@ -3947,7 +4000,7 @@
|
|||
]
|
||||
},
|
||||
"FormatNumberCustom": {
|
||||
"Description": "FormatNumberCustom formats a number with the given precision using the\nnegative, decimal, and grouping options. The `options`\nparameter is a string consisting of `\u003cnegative\u003e \u003cdecimal\u003e \u003cgrouping\u003e`. The\ndefault `options` value is `- . ,`.\n\nNote that numbers are rounded up at 5 or greater.\nSo, with precision set to 0, 1.5 becomes `2`, and 1.4 becomes `1`.\n\nFor a simpler function that adapts to the current language, see FormatNumberCustom.",
|
||||
"Description": "FormatNumberCustom formats a number with the given precision using the\nnegative, decimal, and grouping options. The `options`\nparameter is a string consisting of `\u003cnegative\u003e \u003cdecimal\u003e \u003cgrouping\u003e`. The\ndefault `options` value is `- . ,`.\n\nNote that numbers are rounded up at 5 or greater.\nSo, with precision set to 0, 1.5 becomes `2`, and 1.4 becomes `1`.\n\nFor a simpler function that adapts to the current language, see FormatNumber.",
|
||||
"Args": [
|
||||
"precision",
|
||||
"number",
|
||||
|
@ -4331,6 +4384,12 @@
|
|||
"Aliases": null,
|
||||
"Examples": null
|
||||
},
|
||||
"Clean": {
|
||||
"Description": "",
|
||||
"Args": null,
|
||||
"Aliases": null,
|
||||
"Examples": null
|
||||
},
|
||||
"Dir": {
|
||||
"Description": "",
|
||||
"Args": null,
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<div class="tab-content">
|
||||
{{ range $langs }}
|
||||
<div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}">
|
||||
{{ highlight ($code | transform.Remarshal . | safeHTML) . ""}}
|
||||
{{ highlight ($code | transform.Remarshal . | replaceRE `\n+` "\n" | safeHTML) . "" }}
|
||||
</div>
|
||||
{{ if ne ($.Get "copy") "false" }}
|
||||
<button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button>
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
{{ range $k, $v := $funcs }}
|
||||
{{ if $v.Description }}
|
||||
{{ $func := printf "%s.%s" $pkg $k }}
|
||||
<h2>
|
||||
<a class="header-link" href="#{{ $func | anchorize | safeURL }}">
|
||||
{{ $id := $func | anchorize | safeURL }}
|
||||
<h2 id="{{ $id }}">
|
||||
<a class="header-link" href="#{{ $id }}">
|
||||
<svg class="fill-current o-60 hover-accent-color-light" height="22px" viewBox="0 0 24 24" width="22px" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
|
||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo --gc --minify"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.88.1"
|
||||
HUGO_VERSION = "0.89.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.88.1"
|
||||
HUGO_VERSION = "0.89.4"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.88.1"
|
||||
HUGO_VERSION = "0.89.4"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.88.1"
|
||||
HUGO_VERSION = "0.89.4"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 222 KiB |