mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 02:52:14 -05:00
Merge commit '90ad8045056167004d27857a95542936657b8a16'
This commit is contained in:
commit
af23cdca9c
45 changed files with 366 additions and 156 deletions
1
docs/.gitignore
vendored
1
docs/.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
/.idea
|
||||
/.vscode
|
||||
/public
|
||||
/dist
|
||||
node_modules
|
||||
nohup.out
|
||||
.DS_Store
|
||||
|
|
|
@ -10,10 +10,9 @@ link = "https://esolia.com/post/why-did-esolia-choose-hugo/"
|
|||
logo = "/images/sponsors/esolia-logo.svg"
|
||||
copy = ""
|
||||
|
||||
|
||||
[[banners]]
|
||||
name = "Brave"
|
||||
link = "https://brave.com/"
|
||||
logo = "/images/sponsors/brave-logo.svg"
|
||||
bgcolor = "#5A2FA1"
|
||||
name = "BEP Consulting"
|
||||
link = "https://bep.consulting"
|
||||
logo = "/images/sponsors/bep-consulting.svg"
|
||||
bgcolor = "#004887"
|
||||
copy = ""
|
|
@ -70,14 +70,6 @@
|
|||
{{ partial "hooks/before-body-end" . }}
|
||||
|
||||
|
||||
{{ if .Page.Store.Get "hasMermaid" }}
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||||
<script>
|
||||
mermaid.initialize({ startOnLoad: true });
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
3
docs/_vendor/github.com/gohugoio/gohugoioTheme/static/images/sponsors/bep-consulting.svg
generated
Normal file
3
docs/_vendor/github.com/gohugoio/gohugoioTheme/static/images/sponsors/bep-consulting.svg
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="158" height="160" viewBox="0 0 158 160" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.32 103V27.64H17.664V54.616C18.752 54.04 20 53.56 21.408 53.176C22.816 52.728 24.192 52.376 25.536 52.12C26.88 51.864 28.192 51.672 29.472 51.544C30.816 51.352 32.032 51.256 33.12 51.256C35.872 51.256 38.24 51.704 40.224 52.6C42.272 53.432 43.904 54.584 45.12 56.056C46.336 57.464 47.296 59.32 48 61.624C48.704 63.928 49.152 66.328 49.344 68.824C49.6 71.32 49.728 74.296 49.728 77.752C49.728 86.008 48.448 92.376 45.888 96.856C43.328 101.336 39.072 103.576 33.12 103.576C30.368 103.576 27.584 103 24.768 101.848C21.952 100.696 19.616 99.352 17.76 97.816L15.36 103H4.32ZM17.76 88.984C21.024 91.032 24.992 92.056 29.664 92.056C31.136 92.056 32.352 91.64 33.312 90.808C34.272 89.912 35.008 88.376 35.52 86.2C36.032 83.96 36.288 80.984 36.288 77.272C36.288 73.048 36 69.784 35.424 67.48C34.912 65.176 34.208 63.672 33.312 62.968C32.416 62.2 31.2 61.816 29.664 61.816C27.296 61.816 25.152 61.976 23.232 62.296C21.312 62.552 19.488 63.032 17.76 63.736V88.984ZM56.8958 77.272C56.8958 72.856 57.1518 69.176 57.6638 66.232C58.2398 63.224 59.0398 60.76 60.0638 58.84C61.0878 56.856 62.5278 55.352 64.3838 54.328C66.2398 53.304 68.2878 52.6 70.5278 52.216C72.8318 51.832 75.7118 51.64 79.1678 51.64C81.4718 51.64 83.4238 51.704 85.0238 51.832C86.6238 51.896 88.2238 52.088 89.8238 52.408C91.4878 52.664 92.8318 53.08 93.8558 53.656C94.8798 54.168 95.8718 54.904 96.8318 55.864C97.7918 56.76 98.5278 57.88 99.0398 59.224C99.6158 60.504 100.032 62.072 100.288 63.928C100.608 65.72 100.768 67.8 100.768 70.168C100.768 74.648 99.5838 77.912 97.2158 79.96C94.8478 82.008 91.2958 83.032 86.5598 83.032H70.3358C70.3358 85.976 70.7518 88.184 71.5838 89.656C72.4798 91.064 73.5678 91.928 74.8478 92.248C76.1918 92.568 78.2718 92.728 81.0878 92.728C88.9598 92.728 95.1998 92.376 99.8078 91.672V100.792C95.0078 102.584 86.3038 103.48 73.6958 103.48C70.4318 103.48 67.7118 103 65.5358 102.04C63.4238 101.08 61.7278 99.512 60.4478 97.336C59.1678 95.16 58.2398 92.472 57.6638 89.272C57.1518 86.072 56.8958 82.072 56.8958 77.272ZM70.3358 73.336H83.1038C85.9198 73.336 87.3278 72.056 87.3278 69.496C87.3278 66.296 86.8798 64.248 85.9838 63.352C85.1518 62.392 83.1358 61.912 79.9358 61.912C77.8878 61.912 76.3518 62.008 75.3278 62.2C74.3678 62.328 73.4078 62.776 72.4478 63.544C71.5518 64.248 70.9438 65.368 70.6238 66.904C70.3678 68.44 70.2718 70.584 70.3358 73.336ZM108.101 128.92V52.024H119.141L121.445 57.112C123.301 55.64 125.637 54.328 128.453 53.176C131.333 52.024 134.149 51.448 136.901 51.448C139.397 51.448 141.573 51.864 143.429 52.696C145.349 53.528 146.917 54.68 148.133 56.152C149.413 57.624 150.469 59.448 151.301 61.624C152.133 63.8 152.709 66.168 153.029 68.728C153.349 71.288 153.509 74.136 153.509 77.272C153.509 79.896 153.413 82.264 153.221 84.376C153.093 86.488 152.805 88.6 152.357 90.712C151.909 92.76 151.269 94.552 150.437 96.088C149.669 97.624 148.677 99 147.461 100.216C146.309 101.368 144.837 102.264 143.045 102.904C141.253 103.48 139.205 103.768 136.901 103.768C134.597 103.768 132.005 103.48 129.125 102.904C126.245 102.264 123.685 101.464 121.445 100.504V128.92H108.101ZM121.445 91.288C124.773 92.568 128.773 93.208 133.445 93.208C134.981 93.208 136.197 92.856 137.093 92.152C137.989 91.384 138.693 89.848 139.205 87.544C139.781 85.24 140.069 82.008 140.069 77.848C140.069 72.344 139.525 68.504 138.437 66.328C137.349 64.088 135.685 62.968 133.445 62.968C128.709 62.968 124.709 63.992 121.445 66.04V91.288Z" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 3.5 KiB |
4
docs/_vendor/github.com/gohugoio/gohugoioTheme/static/images/sponsors/your-company.svg
generated
Normal file
4
docs/_vendor/github.com/gohugoio/gohugoioTheme/static/images/sponsors/your-company.svg
generated
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 8 KiB |
|
@ -1 +1 @@
|
|||
# github.com/gohugoio/gohugoioTheme v0.0.0-20220228085601-7cfbda06d135
|
||||
# github.com/gohugoio/gohugoioTheme v0.0.0-20220912070954-88dcaf003b4d
|
||||
|
|
|
@ -4,7 +4,6 @@ linktitle: Comments
|
|||
description: Hugo ships with an internal Disqus template, but this isn't the only commenting system that will work with your new Hugo website.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-09
|
||||
keywords: [sections,content,organization]
|
||||
categories: [project organization, fundamentals]
|
||||
menu:
|
||||
|
@ -60,7 +59,7 @@ These are some alternatives to Disqus:
|
|||
* [Muut](https://muut.com/)
|
||||
* [Remark42](https://remark42.com/) (Open source, Golang, Easy to run docker)
|
||||
* [Staticman](https://staticman.net/)
|
||||
* [Talkyard](https://www.talkyard.io/blog-comments) (Open source, & serverless hosting)
|
||||
* [Talkyard](https://blog-comments.talkyard.io/) (Open source, & serverless hosting)
|
||||
* [Utterances](https://utteranc.es/) (Open source, GitHub comments widget built on GitHub issues)
|
||||
|
||||
[configuration]: /getting-started/configuration/
|
||||
|
|
|
@ -28,7 +28,11 @@ content/
|
|||
└── sunset.jpg <-- page resource
|
||||
```
|
||||
|
||||
To access an image as a page resource:
|
||||
## The Image Resource
|
||||
|
||||
The `image` resource gives you access to image-specific attributes like the picture's `Width` and `Height`, as well as powerful processing methods and filters. More on that below.
|
||||
|
||||
Note that the `image` resource can also be retrieved from a [global resource]({{< relref "/hugo-pipes/introduction#from-file-to-resource" >}})
|
||||
|
||||
```go-html-template
|
||||
{{ $image := .Resources.GetMatch "sunset.jpg" }}
|
||||
|
|
|
@ -4,7 +4,6 @@ linktitle: Multilingual
|
|||
description: Hugo supports the creation of websites with multiple languages side by side.
|
||||
date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
lastmod: 2017-01-10
|
||||
categories: [content management]
|
||||
keywords: [multilingual,i18n, internationalization]
|
||||
menu:
|
||||
|
@ -335,13 +334,13 @@ This article has 101 words.
|
|||
|
||||
### Query a singular/plural translation
|
||||
|
||||
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.
|
||||
In other 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 }}
|
||||
```
|
||||
|
||||
The function will read `.Count` from `.ReadingTime` and evaluate where the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id:
|
||||
The function will read `.Count` from `.ReadingTime` and evaluate whether the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id in `i18n/en-US.toml` file:
|
||||
|
||||
{{< code-toggle file="i18n/en-US" >}}
|
||||
[readingTime]
|
||||
|
@ -349,7 +348,7 @@ one = "One minute to read"
|
|||
other = "{{.Count}} minutes to read"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Assume `.ReadingTime.Count` in the context has value of 525600. The result will be:
|
||||
Assuming `.ReadingTime.Count` in the context has value is 525600. The result will be:
|
||||
|
||||
```text
|
||||
525600 minutes to read
|
||||
|
@ -361,7 +360,7 @@ If `.ReadingTime.Count` in the context has value is 1. The result is:
|
|||
One minute to read
|
||||
```
|
||||
|
||||
In case you need to pass custom data: (`(dict "Count" 25)` is minimum requirement)
|
||||
In case you need to pass a custom data: (`(dict "Count" numeric_value_only)` is minimum requirement)
|
||||
|
||||
```go-html-template
|
||||
{{ i18n "readingTime" (dict "Count" 25 "FirstArgument" true "SecondArgument" false "Etc" "so on, so far") }}
|
||||
|
@ -507,6 +506,40 @@ The rendering of the main navigation works as usual. `.Site.Menus` will just con
|
|||
</ul>
|
||||
```
|
||||
|
||||
### Dynamically localizing menus with i18n
|
||||
While customizing menus per language is useful, your config file can become hard to maintain if you have a lot of languages
|
||||
|
||||
If your menus are the same in all languages (ie. if the only thing that changes is the translated name) you can use the `.Identifier` as a translation key for the menu name:
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
[[menu.main]]
|
||||
name = "About me"
|
||||
url = "about"
|
||||
weight = 1
|
||||
identifier = "about"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
You now need to specify the translations for the menu keys in the i18n files:
|
||||
|
||||
{{< code file="i18n/pt.toml" >}}
|
||||
[about]
|
||||
other="Sobre mim"
|
||||
{{< /code >}}
|
||||
|
||||
And do the appropriate changes in the menu code to use the `i18n` tag with the `.Identifier` as a key. You will also note that here we are using a `default` to fall back to `.Name`, in case the `.Identifier` key is also not present in the language specified in the `defaultContentLanguage` configuration.
|
||||
|
||||
{{< code file="layouts/partials/menu.html" >}}
|
||||
<ul>
|
||||
{{- $currentPage := . -}}
|
||||
{{ range .Site.Menus.main -}}
|
||||
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
|
||||
<a href="{{ .URL | absLangURL }}">{{ i18n .Identifier | default .Name}}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{< /code >}}
|
||||
|
||||
|
||||
## Missing Translations
|
||||
|
||||
If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown.
|
||||
|
@ -535,6 +568,12 @@ To support Multilingual mode in your themes, some considerations must be taken f
|
|||
|
||||
If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string (and is therefore harmless for single-language Hugo websites).
|
||||
|
||||
|
||||
## Generate multilingual content with `hugo new`
|
||||
Currently, `hugo new` is not ready to support generating multilingual content. But there is a [proposal topic](https://github.com/gohugoio/hugo/issues/7732) about this in Github issue to discuss how it should work.
|
||||
|
||||
|
||||
|
||||
[abslangurl]: /functions/abslangurl
|
||||
[config]: /getting-started/configuration/
|
||||
[contenttemplate]: /templates/single-page-templates/
|
||||
|
|
|
@ -64,26 +64,27 @@ content/
|
|||
In the above example `content/` directory, there are four leaf
|
||||
bundles:
|
||||
|
||||
about
|
||||
`about`
|
||||
: This leaf bundle is at the root level (directly under
|
||||
`content` directory) and has only the `index.md`.
|
||||
|
||||
my-post
|
||||
`my-post`
|
||||
: This leaf bundle has the `index.md`, two other content
|
||||
Markdown files and two image files.
|
||||
|
||||
image1
|
||||
: This image is a page resource of `my-post`
|
||||
- image1, image2:
|
||||
These images are page resources of `my-post`
|
||||
and only available in `my-post/index.md` resources.
|
||||
|
||||
image2
|
||||
: This image is a page resource of `my-post`
|
||||
- content1, content2:
|
||||
These content files are page resources of `my-post`
|
||||
and only available in `my-post/index.md` resources.
|
||||
They will **not** be rendered as individual pages.
|
||||
|
||||
my-other-post
|
||||
`my-other-post`
|
||||
: This leaf bundle has only the `index.md`.
|
||||
|
||||
another-leaf-bundle
|
||||
`another-leaf-bundle`
|
||||
: This leaf bundle is nested under couple of
|
||||
directories. This bundle also has only the `index.md`.
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ name
|
|||
: Sets the value returned in `Name`.
|
||||
|
||||
{{% warning %}}
|
||||
The methods `Match` and `GetMatch` use `Name` to match the resources.
|
||||
The methods `Match`, `Get` and `GetMatch` use `Name` to match the resources.
|
||||
{{%/ warning %}}
|
||||
|
||||
title
|
||||
|
|
|
@ -80,6 +80,20 @@ func GetTitleFunc(style string) func(s string) string {
|
|||
}
|
||||
{{< / highlight >}}
|
||||
|
||||
## Highlight Hugo/GO Template Code
|
||||
|
||||
For highlighting Hugo/GO template code on your page, add `/*` after the opening double curly braces and `*/` before closing curly braces.
|
||||
|
||||
``` go
|
||||
{{</*/* myshortcode */*/>}}
|
||||
```
|
||||
|
||||
Gives this:
|
||||
|
||||
``` go
|
||||
{{</* myshortcode */>}}
|
||||
```
|
||||
|
||||
## Highlight Template Func
|
||||
|
||||
See [Highlight](/functions/highlight/).
|
||||
|
|
|
@ -14,8 +14,6 @@ signature: [".RenderString MARKUP"]
|
|||
|
||||
`.RenderString` is a method on `Page` that renders some markup to HTML using the content renderer defined for that page (if not set in the options).
|
||||
|
||||
*Note* that this method does not parse and render shortcodes.
|
||||
|
||||
The method takes an optional map argument with these options:
|
||||
|
||||
display ("inline")
|
||||
|
|
|
@ -18,7 +18,7 @@ deprecated: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
This translates a piece of content based on your `i18n/en-US.yaml` (and similar) files. You can use the [go-i18n](https://github.com/nicksnyder/go-i18n) tools to manage your translations. The translations can exist in both the theme and at the root of your repository.
|
||||
This translates a piece of content based on your `i18n/en-US.toml` files. You can use the [go-i18n](https://github.com/nicksnyder/go-i18n) tools to manage your translations. The translations can exist in both the theme and at the root of your repository.
|
||||
|
||||
```
|
||||
{{ i18n "translation_id" }}
|
||||
|
@ -28,6 +28,27 @@ This translates a piece of content based on your `i18n/en-US.yaml` (and similar)
|
|||
`T` is an alias to `i18n`. E.g. `{{ T "translation_id" }}`.
|
||||
{{% /note %}}
|
||||
|
||||
### Query a flexible translation with variables
|
||||
|
||||
Often you will want to use the page variables in the translation strings. To do so, pass the `.` context when calling `i18n`:
|
||||
|
||||
```
|
||||
{{ i18n "wordCount" . }}
|
||||
```
|
||||
|
||||
The function will pass the `.` context to the `"wordCount"` id:
|
||||
|
||||
{{< code-toggle file="i18n/en-US" >}}
|
||||
[wordCount]
|
||||
other = "This article has {{ .WordCount }} words."
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Assume `.WordCount` in the context has value is 101. The result will be:
|
||||
|
||||
```
|
||||
This article has 101 words.
|
||||
```
|
||||
|
||||
For more information about string translations, see [Translation of Strings in Multilingual Mode][multistrings].
|
||||
|
||||
[multistrings]: /content-management/multilingual/#translation-of-strings
|
||||
|
|
|
@ -218,6 +218,8 @@ Also see the [Filter Method](/content-management/image-processing/#filter).
|
|||
|
||||
Parses the image and returns the height, width, and color model.
|
||||
|
||||
The `imageConfig` function takes a single parameter, a file path (_string_) relative to the _project's root directory_, with or without a leading slash.
|
||||
|
||||
{{% funcsig %}}
|
||||
images.ImageConfig PATH
|
||||
{{% /funcsig %}}
|
||||
|
|
|
@ -23,7 +23,9 @@ toc: false
|
|||
One use case is the concatenation of elements in combination with the [`delimit` function][]:
|
||||
|
||||
{{< code file="slice.html" >}}
|
||||
{{ delimit (slice "foo" "bar" "buzz") ", " }}
|
||||
{{ $sliceOfStrings := slice "foo" "bar" "buzz" }}
|
||||
<!-- returns the slice [ "foo", "bar", "buzz"] -->
|
||||
{{ delimit ($sliceOfStrings) ", " }}
|
||||
<!-- returns the string "foo, bar, buzz" -->
|
||||
{{< /code >}}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ This is also very useful to use as `OR` filters when combined with where:
|
|||
|
||||
```
|
||||
{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }}
|
||||
{{ $pages := $pages | union (where .Site.RegularPages "Params.pinned" true) }}
|
||||
{{ $pages := $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }}
|
||||
{{ $pages = $pages | union (where .Site.RegularPages "Params.pinned" true) }}
|
||||
{{ $pages = $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }}
|
||||
```
|
||||
|
||||
The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page params.
|
||||
|
|
|
@ -4,7 +4,6 @@ linktitle: Configuration
|
|||
description: How to configure your Hugo site.
|
||||
date: 2013-07-01
|
||||
publishdate: 2017-01-02
|
||||
lastmod: 2017-03-05
|
||||
categories: [getting started,fundamentals]
|
||||
keywords: [configuration,toml,yaml,json]
|
||||
menu:
|
||||
|
@ -18,7 +17,6 @@ aliases: [/overview/source-directory/,/overview/configuration/]
|
|||
toc: true
|
||||
---
|
||||
|
||||
|
||||
## Configuration File
|
||||
|
||||
Hugo uses the `config.toml`, `config.yaml`, or `config.json` (if found in the
|
||||
|
@ -77,6 +75,27 @@ foo = "bar"
|
|||
```
|
||||
|
||||
Considering the structure above, when running `hugo --environment staging`, Hugo will use every settings from `config/_default` and merge `staging`'s on top of those.
|
||||
|
||||
Let's take an example to understand this better. Let's say you are using Google Analytics for your website. This requires you to specify `googleAnalytics = "G-XXXXXXXX"` in `config.toml`. Now consider the following scenario:
|
||||
- You don't want the Analytics code to be loaded in development i.e. in your `localhost`
|
||||
- You want to use separate googleAnalytics IDs for your production & staging environments (say):
|
||||
- `G-PPPPPPPP` for production
|
||||
- `G-SSSSSSSS` for staging
|
||||
|
||||
This is how you need to configure your `config.toml` files considering the above scenario:
|
||||
1. In `_default/config.toml` you don't need to mention `googleAnalytics` parameter at all. This ensures that no Google Analytics code is loaded in your development server i.e. when you run `hugo serve`. This works since, by default Hugo sets `Environment=development` when you run `hugo serve` which uses the config files from `_default` folder
|
||||
2. In `production/config.toml` you just need to have one line:
|
||||
|
||||
```googleAnalytics = "G-PPPPPPPP"```
|
||||
|
||||
You don't need to mention all other parameters like `title`, `baseURL`, `theme` etc. again in this config file. You need to mention only those parameters which are different or new for the production environment. This is due to the fact that Hugo is going to __merge__ this on top of `_default/config.toml`. Now when you run `hugo` (build command), by default hugo sets `Environment=production`, so the `G-PPPPPPPP` analytics code will be there in your production website
|
||||
3. Similarly in `staging/config.toml` you just need to have one line:
|
||||
|
||||
```googleAnalytics = "G-SSSSSSSS"```
|
||||
|
||||
Now you need to tell Hugo that you are using the staging environment. So your build command should be `hugo --environment staging` which will load the `G-SSSSSSSS` analytics code in your staging website
|
||||
|
||||
|
||||
{{% note %}}
|
||||
Default environments are __development__ with `hugo server` and __production__ with `hugo`.
|
||||
{{%/ note %}}
|
||||
|
@ -149,7 +168,7 @@ See [Configure File Caches](#configure-file-caches)
|
|||
|
||||
{{< new-in "0.86.0" >}}
|
||||
|
||||
Pass down down default configuration values (front matter) to pages in the content tree. The options in site config is the same as in page front matter, see [Front Matter Cascade](/content-management/front-matter#front-matter-cascade).
|
||||
Pass down default configuration values (front matter) to pages in the content tree. The options in site config is the same as in page front matter, see [Front Matter Cascade](/content-management/front-matter#front-matter-cascade).
|
||||
|
||||
### canonifyURLs
|
||||
|
||||
|
@ -271,7 +290,10 @@ See [Image Processing Config](/content-management/image-processing/#imaging-conf
|
|||
|
||||
**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.
|
||||
A language tag as defined by [RFC 5646](https://datatracker.ietf.org/doc/html/rfc5646). This value is used to populate:
|
||||
|
||||
- The `<language>` element in the internal [RSS template](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml)
|
||||
- The `lang` attribute of the `<html>` element in the internal [alias template](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/alias.html)
|
||||
|
||||
### languages
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ Running the `hugo new site` generator from the command line will create a direct
|
|||
├── content
|
||||
├── data
|
||||
├── layouts
|
||||
├── public
|
||||
├── static
|
||||
└── themes
|
||||
```
|
||||
|
@ -45,7 +46,7 @@ The following is a high-level overview of each of the directories with links to
|
|||
By default, Hugo will create new content files with at least `date`, `title` (inferred from the file name), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes][] with custom preconfigured front matter fields as well.
|
||||
|
||||
[`assets`][]
|
||||
: Stores all the files which need be processed by [Hugo Pipes]({{< ref "/hugo-pipes" >}}). Only the files whose `.Permalink` or `.RelPermalink` are used will be published to the `public` directory. Note: assets directory is not created by default.
|
||||
: Stores all the files which need be processed by [Hugo Pipes](/hugo-pipes/). Only the files whose `.Permalink` or `.RelPermalink` are used will be published to the `public` directory. Note: assets directory is not created by default.
|
||||
|
||||
[`config`](/getting-started/configuration/)
|
||||
: Hugo ships with a large number of [configuration directives][].
|
||||
|
@ -71,11 +72,11 @@ used by Hugo when generating your website. You can write these files in YAML, JS
|
|||
From **Hugo 0.31** you can have multiple static directories.
|
||||
{{% /note %}}
|
||||
|
||||
resources
|
||||
[`resources`][]
|
||||
: Caches some files to speed up generation. Can be also used by template authors to distribute built SASS files, so you don't have to have the preprocessor installed. Note: resources directory is not created by default.
|
||||
|
||||
|
||||
[archetypes]: /content-management/archetypes/
|
||||
[`assets`]: /hugo-pipes/introduction#asset-directory/
|
||||
[configuration directives]: /getting-started/configuration/#all-configuration-settings
|
||||
[`content`]: /content-management/organization/
|
||||
[content section]: /content-management/sections/
|
||||
|
@ -84,6 +85,7 @@ resources
|
|||
[homepage]: /templates/homepage/
|
||||
[`layouts`]: /templates/
|
||||
[`static`]: /content-management/static-files/
|
||||
[`resources`]: /getting-started/configuration/#configure-file-caches
|
||||
[lists]: /templates/list/
|
||||
[pagevars]: /variables/page/
|
||||
[partials]: /templates/partials/
|
||||
|
@ -93,4 +95,3 @@ resources
|
|||
[taxonomies]: /content-management/taxonomies/
|
||||
[taxonomy templates]: /templates/taxonomy-templates/
|
||||
[types]: /content-management/types/
|
||||
[`assets`]: {{< ref "/hugo-pipes/introduction#asset-directory" >}}
|
||||
|
|
|
@ -30,6 +30,12 @@ Hugo in Action is a step-by-step guide to using Hugo to create static websites.
|
|||
|
||||
[Build Websites with Hugo - Fast Web Development with Markdown (2020)](https://pragprog.com/titles/bhhugo/) by Brian P. Hogan.
|
||||
|
||||
## Beginner tutorials
|
||||
|
||||
### Hugo tutorial by CloudCannon
|
||||
|
||||
[Step-by-step written tutorial](https://cloudcannon.com/community/learn/hugo-101/) to teach you the basics of creating a Hugo site.
|
||||
|
||||
## Video tutorials
|
||||
|
||||
### Video Playlist by Mike Dane
|
||||
|
|
|
@ -109,6 +109,7 @@ scoop install hugo-extended
|
|||
#### Prerequisite Tools
|
||||
|
||||
* [Git][installgit]
|
||||
* [GCC][] (For Windows users only)
|
||||
* [Go (at least Go 1.11)](https://golang.org/dl/)
|
||||
|
||||
#### Fetch from GitHub
|
||||
|
@ -126,7 +127,14 @@ go install --tags extended
|
|||
Remove `--tags extended` if you do not want/need Sass/SCSS support.
|
||||
|
||||
{{% note %}}
|
||||
If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.
|
||||
|
||||
##### For installation on Windows
|
||||
|
||||
* Substitute the `$HOME` environment variable above with `%USERPROFILE%`.
|
||||
* If you install `--tags extended` version, you may encounter this error `"gcc": executable file not found in %PATH%`
|
||||
* Please make sure you have installed `gcc` command and add it to `%PATH%`.
|
||||
* "MinGW" is recommended, it has been tested and built successfully
|
||||
|
||||
{{% /note %}}
|
||||
|
||||
## macOS
|
||||
|
@ -358,7 +366,7 @@ The following aims to be a complete guide to installing Hugo on your Windows PC.
|
|||
|
||||
{{< youtube G7umPCU-8xc >}}
|
||||
|
||||
### Assumptions
|
||||
### Assumptions for Windows
|
||||
|
||||
1. You will use `C:\Hugo\Sites` as the starting point for your new project.
|
||||
2. You will use `C:\Hugo\bin` to store executable files.
|
||||
|
@ -376,7 +384,12 @@ You'll need a place to store the Hugo executable, your [content][], and the gene
|
|||
|
||||
1. Download the latest zipped Hugo executable from [Hugo Releases][releases].
|
||||
2. Extract all contents to your `..\Hugo\bin` folder.
|
||||
3. In PowerShell or your preferred CLI, add the `hugo.exe` executable to your PATH by navigating to `C:\Hugo\bin` (or the location of your hugo.exe file) and use the command `set PATH=%PATH%;C:\Hugo\bin`. If the `hugo` command does not work after a reboot, you may have to run the command prompt as administrator.
|
||||
3. Open Windows Command Line (cmd, "DOS") to add the `hugo.exe` executable to your PATH
|
||||
* do `set PATH=%PATH%;C:\Hugo\bin` to have hugo in PATH for the currently opened cmd box
|
||||
* do `setx PATH "%PATH%;C:\Hugo\bin"` to have hugo in PATH for every newly opened cmd box
|
||||
* note: "setx", not "set", plus syntax 'key "val"', not 'key=val'
|
||||
|
||||
> You may also use "Git CMD" from the [Git for Windows package](https://gitforwindows.org/) for the native Windows commands [set](https://ss64.com/nt/set.html) and [setx](https://ss64.com/nt/setx.html), but not "Git Bash", PowerShell, or any other "CLI" with different commands
|
||||
|
||||
### Less-technical Users
|
||||
|
||||
|
@ -468,11 +481,15 @@ Directory of C:\hugo\sites\example.com
|
|||
|
||||
In any of the [Linux distributions that support snaps][snaps], you may install the "extended" Sass/SCSS version with this command:
|
||||
|
||||
```
|
||||
snap install hugo --channel=extended
|
||||
```
|
||||
|
||||
To install the non-extended version without Sass/SCSS support:
|
||||
|
||||
```
|
||||
snap install hugo
|
||||
```
|
||||
|
||||
To switch between the two, use either `snap refresh hugo --channel=extended` or `snap refresh hugo --channel=stable`.
|
||||
|
||||
|
@ -484,7 +501,9 @@ Hugo installed via Snap can write only inside the user’s `$HOME` directory---a
|
|||
|
||||
[@anthonyfok](https://github.com/anthonyfok) and friends in the [Debian Go Packaging Team](https://go-team.pages.debian.net/) maintains an official hugo [Debian package](https://packages.debian.org/hugo) which is shared with [Ubuntu](https://packages.ubuntu.com/hugo) and is installable via `apt-get`:
|
||||
|
||||
```
|
||||
sudo apt-get install hugo
|
||||
```
|
||||
|
||||
What this installs depends on your Debian/Ubuntu version. On Ubuntu bionic (18.04), this installs the non-extended version without Sass/SCSS support. On Ubuntu disco (19.04), this installs the extended version with Sass/SCSS support.
|
||||
|
||||
|
@ -495,14 +514,16 @@ This option is not recommended because the Hugo in Linux package managers for De
|
|||
You can also install Hugo from the Arch Linux [community](https://www.archlinux.org/packages/community/x86_64/hugo/) repository. Applies also to derivatives such as Manjaro.
|
||||
|
||||
```
|
||||
sudo pacman -Syu hugo
|
||||
sudo pacman -S hugo
|
||||
```
|
||||
|
||||
### Fedora, Red Hat and CentOS
|
||||
|
||||
Fedora maintains an [official package for Hugo](https://packages.fedoraproject.org/pkgs/hugo/hugo) which may be installed with:
|
||||
|
||||
```
|
||||
sudo dnf install hugo
|
||||
```
|
||||
|
||||
For the latest version, the Hugo package maintained by [@daftaupe](https://github.com/daftaupe) at Fedora Copr is recommended:
|
||||
|
||||
|
@ -530,7 +551,9 @@ sudo eopkg install hugo
|
|||
|
||||
OpenBSD provides a package for Hugo via `pkg_add`:
|
||||
|
||||
```
|
||||
doas pkg_add hugo
|
||||
```
|
||||
|
||||
|
||||
## Upgrade Hugo
|
||||
|
@ -551,6 +574,7 @@ Now that you've installed Hugo, read the [Quick Start guide][quickstart] and exp
|
|||
[dep]: https://github.com/golang/dep
|
||||
[highlight shortcode]: /content-management/shortcodes/#highlight
|
||||
[installgit]: https://git-scm.com/
|
||||
[GCC]: http://www.mingw.org/
|
||||
[installgo]: https://golang.org/dl/
|
||||
[linuxbrew]: https://docs.brew.sh/Homebrew-on-Linux
|
||||
[quickstart]: /getting-started/quick-start/
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
title: Host on 21YunBox
|
||||
linktitle: Host on 21YunBox
|
||||
description: Host your Hugo site with 21YunBox's blazing fast Chinese CDN, fully-managed SSL and auto deploys from Gitee.
|
||||
date: 2021-01-06
|
||||
publishdate: 2021-01-06
|
||||
lastmod: 2021-01-06
|
||||
categories: [hosting and deployment]
|
||||
keywords: [21yunbox,hosting,deployment]
|
||||
authors: [Toby Glei]
|
||||
menu:
|
||||
docs:
|
||||
parent: "hosting-and-deployment"
|
||||
weight: 10
|
||||
weight: 10
|
||||
sections_weight: 10
|
||||
draft: false
|
||||
aliases: []
|
||||
toc: true
|
||||
---
|
||||
|
||||
[21YunBox](https://www.21yunbox.com) is a fully-managed cloud platform dedicated to make web deployment easy within the Chinese Great Firewall where you can host static sites, backend APIs, databases, cron jobs, and all your other apps in one place. It provides blazing fast Chinese CDN, continuous deployment, one-click HTTPS and [other services like managed databases and backend web services](https://www.21yunbox.com/docs/), providing an avenue to launch web projects in China.
|
||||
|
||||
21YunBox includes the following features:
|
||||
|
||||
- Continuous, automatic builds & deploys from GitHub and Gitee
|
||||
- Automatic SSL certificates through [Let's Encrypt](https://letsencrypt.org)
|
||||
- Instant cache invalidation with a blazing fast, Chinese CDN
|
||||
- Unlimited [custom domains](https://www.21yunbox.com/docs/#/custom-domains)
|
||||
- Automatic [Brotli compression](https://en.wikipedia.org/wiki/Brotli) for faster sites
|
||||
- Native HTTP/2 support
|
||||
- Automatic HTTP → HTTPS redirects
|
||||
- Custom URL redirects and rewrites
|
||||
|
||||
## Prerequisites
|
||||
|
||||
This guide assumes you already have a Hugo project to deploy. If you need a project, use the [Quick Start](/getting-started/quick-start/) to get started or fork 21YunBox's [Hugo Example](https://gitee.com/eryiyunbox-examples/hello-hugo) before continuing.
|
||||
|
||||
## Setup
|
||||
|
||||
You can set up a Hugo site on 21YunBox in two quick steps:
|
||||
|
||||
1. Create a new web service on 21YunBox, and give 21YunBox permission to access your GitHub or Gitee repo.
|
||||
2. Use the following values during creation:
|
||||
|
||||
| Field | Value |
|
||||
| --------------------- | ------------------------------------------------ |
|
||||
| **Environment** | `Static Site` |
|
||||
| **Build Command** | `hugo --gc --minify` (or your own build command) |
|
||||
| **Publish Directory** | `./public` (or your own output directory) |
|
||||
|
||||
That's it! Your site will be live on your 21YunBox URL (which looks like `yoursite.21yunbox.com`) as soon as the build is done.
|
||||
|
||||
## Continuous deploys
|
||||
|
||||
Now that 21YunBox is connected to your repo, it will automatically build and publish your site any time you push to GitHub.
|
||||
|
||||
Every deploy automatically and instantly invalidates the CDN cache, so your users can always access the latest content on your site.
|
||||
|
||||
## Custom domains
|
||||
|
||||
Add your own domains to your site easily using 21YunBox's [custom domains](https://www.21yunbox.com/docs/#/custom-domains) guide.
|
||||
|
||||
## Support
|
||||
Click [here](https://www.21yunbox.com/docs/#/contact) to contact with 21YunBox' experts if you need help.
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: Hosting on Azure Static Web Apps
|
||||
linktitle: Hosting on Azure Static Web Apps
|
||||
description: Learn how to deploy a Hugo application to Azure Static Web Apps.
|
||||
date: 2022-05-09
|
||||
publishdate: 2022-05-09
|
||||
categories: [hosting and deployment]
|
||||
keywords: [hosting,Azure Static Web Apps]
|
||||
authors: [Azure Static Web Apps]
|
||||
menu:
|
||||
docs:
|
||||
parent: "hosting-and-deployment"
|
||||
weight: 200
|
||||
weight: 200
|
||||
sections_weight: 200
|
||||
draft: false
|
||||
toc: true
|
||||
aliases: []
|
||||
---
|
||||
|
||||
You can create and deploy a Hugo web application to Azure Static Web Apps. The final result is a new Azure Static Web App with associated GitHub Actions that give you control over how the app is built and published. You'll learn how to create a Hugo app, setup an Azure Static Web App and deploy the Hugo app to Azure.
|
||||
|
||||
Here's the tutorial on how to [Publish a Hugo site to Azure Static Web Apps](https://docs.microsoft.com/en-us/azure/static-web-apps/publish-hugo).
|
|
@ -47,7 +47,7 @@ As mentioned in the [GitHub Pages documentation][ghorgs], you can host a user/or
|
|||
|
||||
## Build Hugo With GitHub Action
|
||||
|
||||
GitHub executes your software development workflows. Everytime you push your code on the Github repository, Github Actions will build the site automatically.
|
||||
GitHub executes your software development workflows. Everytime you push your code on the GitHub repository, Github Actions will build the site automatically.
|
||||
|
||||
Create a file in `.github/workflows/gh-pages.yml` containing the following content (based on [actions-hugo](https://github.com/marketplace/actions/hugo-setup)):
|
||||
|
||||
|
@ -62,9 +62,9 @@ on:
|
|||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true # Fetch Hugo themes (true OR recursive)
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
@ -88,10 +88,12 @@ 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
|
||||
## 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.
|
||||
|
|
|
@ -65,6 +65,10 @@ compact [bool]
|
|||
verbose [bool]
|
||||
: Log everything
|
||||
|
||||
sourceMap [string]
|
||||
: Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output file name + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
```go-html-template
|
||||
|
|
|
@ -70,6 +70,10 @@ With the above, these imports should work in both scenarios:
|
|||
import * as React from 'react'
|
||||
import * as ReactDOM from 'react-dom';
|
||||
```
|
||||
sourceMap [string, bool] {{< new-in "0.75.0" >}}
|
||||
: Let `js.Build` output sourceMap. Current only inline is supported. true defaults to inline.
|
||||
One of: '`inline`, `external`
|
||||
Default is "" (disabled)
|
||||
|
||||
target [string]
|
||||
: The language target.
|
||||
|
@ -93,7 +97,7 @@ format [string] {{< new-in "0.74.3" >}}
|
|||
Default is `iife`, a self-executing function, suitable for inclusion as a <script> tag.
|
||||
|
||||
sourceMap
|
||||
: Whether to generate source maps. Enum, currently only `inline` (we will improve that).
|
||||
: Whether to generate `inline` or `external` sourcemap from esbuild. External sourcemaps will be written to the target with the output file name + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.
|
||||
|
||||
### Import JS code from /assets
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ If you are using the Hugo Snap package, PostCSS and plugin(s) need to be install
|
|||
### Options
|
||||
|
||||
config [string]
|
||||
: Path to the PostCSS configuration file
|
||||
: Set a custom directory to look for a config file
|
||||
|
||||
noMap [bool]
|
||||
: Default is `false`. Disable the default inline sourcemaps
|
||||
|
@ -63,7 +63,7 @@ syntax [string]
|
|||
: Custom postcss syntax
|
||||
|
||||
```go-html-template
|
||||
{{ $options := dict "config" "customPostCSS.js" "noMap" true }}
|
||||
{{ $options := dict "config" "/path/to/custom-config-directory" "noMap" true }}
|
||||
{{ $style := resources.Get "css/main.css" | resources.PostCSS $options }}
|
||||
|
||||
{{ $options := dict "use" "autoprefixer postcss-color-alpha" }}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
A business page for Flesland Flis AS. A Norwegian Tiler located in Bergen.
|
||||
|
||||
The page is designed and developed by Sindre Gusdal:
|
||||
|
||||
* [Absoluttweb AS](https://www.absoluttweb.no)
|
||||
* [Sindre Gusdal](https://www.linkedin.com/in/sindregusdal/)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 302 KiB |
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
|
||||
title: Flesland Flis AS
|
||||
date: 2018-04-24
|
||||
description: "showcase: Business Page for a tile shop in Bergen, Norway"
|
||||
siteURL: https://www.fleslandflis.no
|
||||
byline: "[Sindre Gusdal](https://www.absoluttweb.no), Absoluttweb AS"
|
||||
|
||||
---
|
||||
|
||||
For **Flesland Flis** I use a combination of **Hugo, Forestry.io and Netlify**. Static Site Generators and Hugo has been on my radar for a long time, and with all the nice features released in Hugo the last years, it's now my preferred solution for new clients. Also a huge thanks to the guys at [Forestry.io](https://forestry.io), for making such a smooth CMS for Hugo.
|
||||
|
||||
The #1 reason why I love Hugo is the logic between content and layout, and of course the speed. Compared to solutions like Jekyll, Hugo is just better at all the stuff I value the most - speed, flexibility, theming and more.
|
||||
|
||||
### Thanks, Hugo!
|
||||
|
||||
Today I use Hugo in a combination with GULP and Foundation 6 + my own Hugo starter theme. This works great for me, and gives me all the flexibility I need. Then I can include FancyBox, Responsive Text and other Node Modules when needed.
|
||||
|
||||
In the past I had to do a lot of changes to layout, content and css, if the client f.ex needed an extra PDF or an image-gallery to a certain page. Just small details not fitting in the template, would be a hassle. So updating existing webpages was boring and time consuming.
|
||||
|
||||
Today I just copy-paste a new layout file, adds some frontmatter, Pushes to GIT and that special page is done.
|
||||
|
||||
**Gotta love it:)**
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
The site is built by:
|
||||
|
||||
* [Lauren Waller](https://twitter.com/waller_texas)
|
||||
* [Wayne Ashley Berry](https://twitter.com/waynethebrain)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 190 KiB |
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
title: Over
|
||||
date: 2018-09-12
|
||||
description: "Showcase: \"People from all disciplines contribute to our website; Hugo’s single static binary makes that possible.\""
|
||||
siteURL: https://madewithover.com/
|
||||
|
||||
---
|
||||
|
||||
At Over we're into creativity, and technology should not get in the way. We want it to be easy for everyone to create, and Hugo does the same for us. That's one of the reasons many of us are fond of using it.
|
||||
|
||||
People from all disciplines contribute to our website, be it legal documentation, layout and design, recruiting, marketing and of course… engineering. Hugo allows us to do this with as little friction as possible. A lot of this comes down to Hugo being distributed as a single static binary. Copy, paste, run... and you're up and running!
|
||||
|
||||
We use Wercker for continuous integration and deployments, [GitHub](https://github.com/) for contributing to and writing markdown and [Firebase](https://firebase.google.com/docs/hosting/) for hosting.
|
||||
|
||||
This infrastructure takes all the pressure off our engineers, anyone can contribute to our website. Anyone else can review the changes, and of course anyone with permission can deploy those approved changes as well!
|
||||
|
||||
We're busy working on a few new features for our website, and Hugo continues to deliver above and beyond. We're so happy with the choice we made to use Hugo and to us it has become the de-facto static site generator.
|
|
@ -4,7 +4,6 @@ linktitle: 404 Page
|
|||
description: If you know how to create a single page template, you have unlimited options for creating a custom 404.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-31
|
||||
categories: [templates]
|
||||
keywords: [404, page not found]
|
||||
menu:
|
||||
|
@ -36,7 +35,7 @@ This is a basic example of a 404.html template:
|
|||
{{ define "main"}}
|
||||
<main id="main">
|
||||
<div>
|
||||
<h1 id="title"><a href="{{ "/" | relURL }}">Go Home</a></h1>
|
||||
<h1 id="title"><a href="{{ "" | relURL }}">Go Home</a></h1>
|
||||
</div>
|
||||
</main>
|
||||
{{ end }}
|
||||
|
@ -54,7 +53,8 @@ Your 404.html file can be set to load automatically when a visitor enters a mist
|
|||
* Caddy Server. Use the `handle_errors` directive to specify error pages for one or more status codes. [Details here](https://caddyserver.com/docs/caddyfile/directives/handle_errors)
|
||||
* Netlify. Add `/* /404.html 404` to `content/_redirects`. [Details Here](https://www.netlify.com/docs/redirects/#custom-404)
|
||||
* Azure Static website. You can specify the `Error document path` in the Static website configuration page of the Azure portal. [More details are available in the Static website documentation](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website).
|
||||
* DigitalOcean App Platform. You can specify `error_document` in your app specification file or use control panel to set up error document. [Details here](https://docs.digitalocean.com/products/app-platform/references/app-specification-reference/).
|
||||
* DigitalOcean App Platform. You can specify `error_document` in your app specification file or use control panel to set up error document. [Details here](https://docs.digitalocean.com/products/app-platform/how-to/manage-static-sites/#configure-a-static-site).
|
||||
* [Firebase Hosting](https://firebase.google.com/docs/hosting/full-config#404): `/404.html` automatically gets used as the 404 page.
|
||||
|
||||
{{% note %}}
|
||||
`hugo server` will not automatically load your custom `404.html` file, but you
|
||||
|
|
|
@ -78,7 +78,9 @@ sectionPagesMenu = "main"
|
|||
|
||||
The menu name can be anything, but take a note of what it is.
|
||||
|
||||
This will create a menu with all the sections as menu items and all the sections' pages as "shadow-members". The _shadow_ implies that the pages isn't represented by a menu-item themselves, but this enables you to create a top-level menu like this:
|
||||
This will create a menu with all the sections as menu items and all the sections' pages as "shadow-members". Ensure that all first level directories that you would like to show up on this menu are [Branch Bundles](https://gohugo.io/content-management/sections/). Leaf Bundles do not form sections.
|
||||
|
||||
The _shadow_ implies that the pages isn't represented by a menu-item themselves, but this enables you to create a top-level menu like this:
|
||||
|
||||
```
|
||||
<nav class="sidebar-nav">
|
||||
|
|
|
@ -303,7 +303,7 @@ The rendered output of the HTML example code block will be as follows:
|
|||
|
||||
### Nested Shortcode: Image Gallery
|
||||
|
||||
Hugo's [`.Parent` shortcode variable][parent] returns a boolean value depending on whether the shortcode in question is called within the context of a *parent* shortcode. This provides an inheritance model for common shortcode parameters.
|
||||
Hugo's [`.Parent` shortcode variable][parent] provides access to the parent shortcode context when the shortcode in question is called within the context of a *parent* shortcode. This provides an inheritance model for common shortcode parameters.
|
||||
|
||||
The following example is contrived but demonstrates the concept. Assume you have a `gallery` shortcode that expects one named `class` parameter:
|
||||
|
||||
|
|
|
@ -28,4 +28,5 @@ toc: false
|
|||
|
||||
* [DATOCMS](https://www.datocms.com) DatoCMS is a fully customizable administrative area for your static websites. Use your favorite website generator, let your clients publish new content independently, and the host the site anywhere you like.
|
||||
* [Forestry.io](https://forestry.io/). Forestry is a git-backed CMS for Hugo, Gatsby, Jekyll and VuePress websites with support for GitHub, GitLab, Bitbucket and Azure Devops. Forestry provides a nice user interface to edit and model content for non technical editors. It supports S3, Cloudinary and Netlify Large Media integrations for storing media. Every time an update is made via the CMS, Forestry will commit changes back to your repo and vice-versa.
|
||||
* [CloudCannon](https://cloudcannon.com/hugo-cms/). The intuitive Git-based CMS for your Hugo website. CloudCannon syncs changes from your Git repository and pushes content changes back, so your development and content teams are always in sync. Edit all of your content on the page with visual editing, build entire pages with reusable custom components and then publish confidently.
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ toc: true
|
|||
A static website with a dynamic search function? Yes, Hugo provides an alternative to embeddable scripts from Google or other search engines for static websites. Hugo allows you to provide your visitors with a custom search function by indexing your content files directly.
|
||||
|
||||
* [GitHub Gist for Hugo Workflow](https://gist.github.com/sebz/efddfc8fdcb6b480f567). This gist contains a simple workflow to create a search index for your static website. It uses a simple Grunt script to index all your content files and [lunr.js](https://lunrjs.com/) to serve the search results.
|
||||
* [hugo-elasticsearch](https://www.npmjs.com/package/hugo-elasticsearch). Generate [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html) indexes for Hugo static sites by parsing front matter. Hugo-Elasticsearch will generate a newline delimited JSON (NDJSON) file that can be bulk uploaded into Elasticsearch using any one of the available [clients](https://www.elastic.co/guide/en/elasticsearch/client/index.html).
|
||||
|
||||
* [hugo-lunr](https://www.npmjs.com/package/hugo-lunr). A simple way to add site search to your static Hugo site using [lunr.js](https://lunrjs.com/). Hugo-lunr will create an index file of any html and markdown documents in your Hugo project.
|
||||
* [hugo-lunr-zh](https://www.npmjs.com/package/hugo-lunr-zh). A bit like Hugo-lunr, but Hugo-lunr-zh can help you separate the Chinese keywords.
|
||||
* [Github Gist for Fuse.js integration](https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae). This gist demonstrates how to leverage Hugo's existing build time processing to generate a searchable JSON index used by [Fuse.js](https://fusejs.io/) on the client side. Although this gist uses Fuse.js for fuzzy matching, any client side search tool capable of reading JSON indexes will work. Does not require npm, grunt or other build-time tools except Hugo!
|
||||
|
|
|
@ -23,11 +23,12 @@ Know of a Hugo-related starter kit that isn't mentioned here? [Please add it to
|
|||
The following starter kits are developed by active members of the Hugo community. If you find yourself having issues with any of the projects, it's best to file an issue directly with the project's maintainer(s).
|
||||
{{% /note %}}
|
||||
|
||||
* [Wowchemy][]. Wowchemy is the 5,500+ star open source Hugo starter kit and website builder trusted by 750,000+ sites since 2016. Create _any_ kind of site with [50+ templates, widgets, and extensions](https://wowchemy.com/). Translated into 35+ languages and backed by a large, active community of 150+ contributors.
|
||||
* [Hugo Wrapper][hugow]. Hugo Wrapper is a POSIX-style shell script which acts as a wrapper to download and run Hugo binary for your platform. It can be executed in variety of [Operating Systems][hugow-test] and [Command Shells][hugow-test].
|
||||
* [GOHUGO AMP][]. GoHugo AMP is a starter theme that aims to make it easy to adopt [Google's AMP Project][amp]. The starter kit comes with 40+ shortcodes and partials plus automatic structured data. The project also includes a [separate site with extensive documentation][gohugodocs].
|
||||
* [Hyas][]. Hyas is a Hugo starter helping you build modern websites that are secure, fast, and SEO-ready — by default. It is Netlify-ready (functions, redirects, headers) and comes with [documentation](https://gethyas.com/) to easily make it your own.
|
||||
|
||||
|
||||
[Wowchemy]: https://github.com/wowchemy/wowchemy-hugo-modules
|
||||
[addkit]: https://github.com/gohugoio/hugo/edit/master/docs/content/en/tools/starter-kits.md
|
||||
[amp]: https://amp.dev
|
||||
[GOHUGO AMP]: https://github.com/wildhaber/gohugo-amp
|
||||
|
|
|
@ -4,7 +4,6 @@ linktitle: Build Performance
|
|||
description: An overview of features used for diagnosing and improving performance issues in site builds.
|
||||
date: 2017-03-12
|
||||
publishdate: 2017-03-12
|
||||
lastmod: 2017-03-12
|
||||
keywords: [performance, build]
|
||||
categories: [troubleshooting]
|
||||
menu:
|
||||
|
@ -16,10 +15,6 @@ aliases: []
|
|||
toc: true
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
The example site used below is from https://github.com/gohugoio/hugo/tree/master/examples/blog
|
||||
{{% /note %}}
|
||||
|
||||
## Template Metrics
|
||||
|
||||
Hugo is a very fast static site generator, but it is possible to write
|
||||
|
|
|
@ -21,6 +21,8 @@ aliases: [/faq/]
|
|||
|
||||
Is your markdown file [in draft mode](https://gohugo.io/content-management/front-matter/#front-matter-variables)? When testing, run `hugo server` with the `-D` or `--buildDrafts` [switch](https://gohugo.io/getting-started/usage/#draft-future-and-expired-content).
|
||||
|
||||
Is your markdown file part of a [leaf bundle](/content-management/page-bundles/)? If there is an `index.md` file in the same or any parent directory then other markdown files will not be rendered as individual pages.
|
||||
|
||||
## Can I set configuration variables via OS environment?
|
||||
|
||||
Yes you can! See [Configure with Environment Variables](/getting-started/configuration/#configure-with-environment-variables).
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/gohugoio/gohugoioTheme v0.0.0-20220228085601-7cfbda06d135 // indirect
|
||||
require github.com/gohugoio/gohugoioTheme v0.0.0-20220912070954-88dcaf003b4d // indirect
|
||||
|
|
|
@ -33,3 +33,7 @@ github.com/gohugoio/gohugoioTheme v0.0.0-20211211125852-b85e21c1f3d6 h1:lAgdWrn8
|
|||
github.com/gohugoio/gohugoioTheme v0.0.0-20211211125852-b85e21c1f3d6/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
|
||||
github.com/gohugoio/gohugoioTheme v0.0.0-20220228085601-7cfbda06d135 h1:6hVzfE9YhSsZP5t6jWjvVp7MoPm7Y5fEhH/ls4ahhKk=
|
||||
github.com/gohugoio/gohugoioTheme v0.0.0-20220228085601-7cfbda06d135/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
|
||||
github.com/gohugoio/gohugoioTheme v0.0.0-20220905093719-cb8b64046950 h1:Ovlh3nuy/aNptYZHmIra2MP+ZUEqiihY0HxvhdaMqGg=
|
||||
github.com/gohugoio/gohugoioTheme v0.0.0-20220905093719-cb8b64046950/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
|
||||
github.com/gohugoio/gohugoioTheme v0.0.0-20220912070954-88dcaf003b4d h1:UYJL6RmEepprvlgHvDnFCWtPOvjmqzFCQ90cRDRBO7U=
|
||||
github.com/gohugoio/gohugoioTheme v0.0.0-20220912070954-88dcaf003b4d/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
|
||||
|
|
29
docs/hugoreleaser.toml
Normal file
29
docs/hugoreleaser.toml
Normal file
|
@ -0,0 +1,29 @@
|
|||
project = "hugoDocs"
|
||||
|
||||
[release_settings]
|
||||
name = "${HUGORELEASER_TAG}"
|
||||
type = "github"
|
||||
repository = "hugoDocs"
|
||||
repository_owner = "gohugoio"
|
||||
|
||||
draft = true
|
||||
prerelease = false
|
||||
|
||||
[release_settings.release_notes_settings]
|
||||
generate = true
|
||||
generate_on_host = false
|
||||
short_threshold = 10
|
||||
short_title = "What's Changed"
|
||||
|
||||
groups = [
|
||||
{ regexp = "snapcraft:|Merge commit|Merge branch|netlify:|release:|Squashed", ignore = true },
|
||||
{ title = "Typo fixes", regexp = "typo", ordinal = 20 },
|
||||
{ title = "Dependency Updates", regexp = "deps", ordinal = 30 },
|
||||
{ title = "Improvements", regexp = ".*", ordinal = 10 },
|
||||
]
|
||||
|
||||
[[releases]]
|
||||
paths = ["archives/**"]
|
||||
# In this file we have only one release, but path can be used to partition the release step, e.g.:
|
||||
# hugoreleaser release -paths "releases/myrelease"
|
||||
path = "myrelease"
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo --gc --minify"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.101.0"
|
||||
HUGO_VERSION = "0.102.3"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
|||
command = "hugo --gc --minify --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.101.0"
|
||||
HUGO_VERSION = "0.102.3"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.101.0"
|
||||
HUGO_VERSION = "0.102.3"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.101.0"
|
||||
HUGO_VERSION = "0.102.3"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
Loading…
Reference in a new issue