mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-17 12:34:44 -04:00
Miscellaneous edits
This commit is contained in:
parent
ad3f9cdb6d
commit
d46f0b1d83
@ -54,39 +54,39 @@ weight = 2
|
||||
subtitle = 'Reference, Tutorials, and Explanations'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
`defaultContentLanguage`
|
||||
defaultContentLanguage
|
||||
: (`string`) The project's default language tag as defined by [RFC 5646]. Must be lower case, and must match one of the defined language keys. Default is `en`. Examples:
|
||||
|
||||
- `en`
|
||||
- `en-gb`
|
||||
- `pt-br`
|
||||
|
||||
`defaultContentLanguageInSubdir`
|
||||
defaultContentLanguageInSubdir
|
||||
: (`bool`) If `true`, Hugo renders the default language site in a subdirectory matching the `defaultContentLanguage`. Default is `false`.
|
||||
|
||||
`contentDir`
|
||||
contentDir
|
||||
: (`string`) The content directory for this language. Omit if [translating by file name].
|
||||
|
||||
`disabled`
|
||||
disabled
|
||||
: (`bool`) If `true`, Hugo will not render content for this language. Default is `false`.
|
||||
|
||||
`languageCode`
|
||||
languageCode
|
||||
: (`string`) The language tag as defined by [RFC 5646]. This value may include upper and lower case characters, hyphens or underscores, and does not affect localization or URLs. Hugo uses this value to populate the `language` element in the [built-in RSS template], and the `lang` attribute of the `html` element in the [built-in alias template]. Examples:
|
||||
|
||||
- `en`
|
||||
- `en-GB`
|
||||
- `pt-BR`
|
||||
|
||||
`languageDirection`
|
||||
languageDirection
|
||||
: (`string`) The language direction, either left-to-right (`ltr`) or right-to-left (`rtl`). Use this value in your templates with the global [`dir`] HTML attribute.
|
||||
|
||||
`languageName`
|
||||
languageName
|
||||
: (`string`) The language name, typically used when rendering a language switcher.
|
||||
|
||||
`title`
|
||||
title
|
||||
: (`string`) The language title. When set, this overrides the site title for this language.
|
||||
|
||||
`weight`
|
||||
weight
|
||||
: (`int`) The language weight. When set to a non-zero value, this is the primary sort criteria for this language.
|
||||
|
||||
[`dir`]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
|
||||
@ -349,7 +349,9 @@ Private use subtags must not exceed 8 alphanumeric characters.
|
||||
|
||||
### Query basic translation
|
||||
|
||||
From within your templates, use the `i18n` function like this:
|
||||
From within your templates, use the [`i18n`] function like this:
|
||||
|
||||
[`i18n`]: /functions/lang/translate
|
||||
|
||||
```go-html-template
|
||||
{{ i18n "home" }}
|
||||
|
@ -162,7 +162,9 @@ Any imports in a file outside `/assets` or that does not resolve to a component
|
||||
|
||||
The start directory for resolving npm packages (aka. packages that live inside a `node_modules` folder) is always the main project folder.
|
||||
|
||||
**Note:** If you're developing a theme/component that is supposed to be imported and depends on dependencies inside `package.json`, we recommend reading about [hugo mod npm pack](/commands/hugo_mod_npm_pack/), a tool to consolidate all the npm dependencies in a project.
|
||||
{{% note %}}
|
||||
If you're developing a theme/component that is supposed to be imported and depends on dependencies inside `package.json`, we recommend reading about [hugo mod npm pack](/commands/hugo_mod_npm_pack/), a tool to consolidate all the npm dependencies in a project.
|
||||
{{% /note %}}
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -19,9 +19,11 @@ aliases: [/functions/partialcached]
|
||||
|
||||
The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation.
|
||||
|
||||
**Note:** Each Site (or language) has its own `partialCached` cache, so each site will execute a partial once.
|
||||
{{% note %}}
|
||||
Each Site (or language) has its own `partialCached` cache, so each site will execute a partial once.
|
||||
|
||||
**Note**: Hugo renders pages in parallel, and will render the partial more than once with concurrent calls to the `partialCached` function. After Hugo caches the rendered partial, new pages entering the build pipeline will use the cached result.
|
||||
Hugo renders pages in parallel, and will render the partial more than once with concurrent calls to the `partialCached` function. After Hugo caches the rendered partial, new pages entering the build pipeline will use the cached result.
|
||||
{{% /note %}}
|
||||
|
||||
Here is the simplest usage:
|
||||
|
||||
|
@ -715,7 +715,9 @@ If you are using snake_cased variable names, the above will not work. Hugo deter
|
||||
|
||||
## Ignore content and data files when rendering
|
||||
|
||||
**Note:** This works, but we recommend you use the newer and more powerful [includeFiles and excludeFiles](/hugo-modules/configuration/#module-configuration-mounts) mount options.
|
||||
{{% note %}}
|
||||
This works, but we recommend you use the newer and more powerful [includeFiles and excludeFiles](/hugo-modules/configuration/#module-configuration-mounts) mount options.
|
||||
{{% /note %}}
|
||||
|
||||
To exclude specific files from the `content`, `data`, and `i18n` directories when rendering your site, set `ignoreFiles` to one or more regular expressions to match against the absolute file path.
|
||||
|
||||
|
@ -144,7 +144,9 @@ Any imports in a file outside `/assets` or that does not resolve to a component
|
||||
|
||||
The start directory for resolving npm packages (aka. packages that live inside a `node_modules` folder) is always the main project folder.
|
||||
|
||||
**Note:** If you're developing a theme/component that is supposed to be imported and depends on dependencies inside `package.json`, we recommend reading about [hugo mod npm pack](/commands/hugo_mod_npm_pack/), a tool to consolidate all the npm dependencies in a project.
|
||||
{{% note %}}
|
||||
If you're developing a theme/component that is supposed to be imported and depends on dependencies inside `package.json`, we recommend reading about [hugo mod npm pack](/commands/hugo_mod_npm_pack/), a tool to consolidate all the npm dependencies in a project.
|
||||
{{% /note %}}
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -29,7 +29,7 @@ With a global collection, the navigation sort order is fixed, using Hugo's defau
|
||||
3. Page [linkTitle], falling back to page [title]
|
||||
4. Page file path if the page is backed by a file
|
||||
|
||||
For example, with a global collection sorted by title, the navigation sort order will use Hugo's default sort order. This is probably not what you want or expect. For this reason, the `Next` and `Prev` methods on a `Pages` object are a generally a better choice.
|
||||
For example, with a global collection sorted by title, the navigation sort order will use Hugo's default sort order. This is probably not what you want or expect. For this reason, the `Next` and `Prev` methods on a `Pages` object are generally a better choice.
|
||||
|
||||
[date]: /methods/page/date
|
||||
[weight]: /methods/page/weight
|
||||
|
@ -20,11 +20,12 @@ This template code:
|
||||
|
||||
```go-html-template
|
||||
{{ with .GetTerms "tags" }}
|
||||
<p>Tags:
|
||||
<p>Tags</p>
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{ end }}
|
||||
</p>
|
||||
</ul>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
|
@ -63,7 +63,7 @@ With the `PrevInSection` and `NextInSection` methods, the navigation sort order
|
||||
3. Page [linkTitle], falling back to page [title]
|
||||
4. Page file path if the page is backed by a file
|
||||
|
||||
For example, with a page collection sorted by title, the navigation sort order will use Hugo’s default sort order. This is probably not what you want or expect. For this reason, the Next and Prev methods on a Pages object are a generally a better choice.
|
||||
For example, with a page collection sorted by title, the navigation sort order will use Hugo’s default sort order. This is probably not what you want or expect. For this reason, the Next and Prev methods on a Pages object are generally a better choice.
|
||||
|
||||
[date]: /methods/page/date
|
||||
[weight]: /methods/page/weight
|
||||
|
@ -64,7 +64,7 @@ With the `PrevInSection` and `NextInSection` methods, the navigation sort order
|
||||
3. Page [linkTitle], falling back to page [title]
|
||||
4. Page file path if the page is backed by a file
|
||||
|
||||
For example, with a page collection sorted by title, the navigation sort order will use Hugo’s default sort order. This is probably not what you want or expect. For this reason, the Next and Prev methods on a Pages object are a generally a better choice.
|
||||
For example, with a page collection sorted by title, the navigation sort order will use Hugo’s default sort order. This is probably not what you want or expect. For this reason, the Next and Prev methods on a Pages object are generally a better choice.
|
||||
|
||||
[date]: /methods/page/date
|
||||
[weight]: /methods/page/weight
|
||||
|
@ -19,19 +19,14 @@ While the following internal templates are called similar to partials, they do *
|
||||
|
||||
## Google Analytics
|
||||
|
||||
Hugo ships with an internal template supporting [Google Analytics 4][GA4] (GA4).
|
||||
Hugo ships with an internal template supporting [Google Analytics 4].
|
||||
|
||||
**Note:** Universal Analytics are [deprecated].
|
||||
|
||||
[GA4]: https://support.google.com/analytics/answer/10089681
|
||||
[deprecated]: https://support.google.com/analytics/answer/11583528
|
||||
[Google Analytics 4]: https://support.google.com/analytics/answer/10089681
|
||||
|
||||
### Configure Google Analytics
|
||||
|
||||
Provide your tracking ID in your configuration file:
|
||||
|
||||
**Google Analytics 4 (gtag.js)**
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[services.googleAnalytics]
|
||||
googleAnalytics = "G-MEASUREMENT_ID"
|
||||
|
@ -53,7 +53,9 @@ The above example adds one new media type, `text/enriched`, and changes the suff
|
||||
mediaType = "text/html"
|
||||
{{</ code-toggle >}}
|
||||
|
||||
**Note** that for the above to work, you also need to add an `outputs` definition in your site configuration.
|
||||
{{% note %}}
|
||||
For the above to work, you also need to add an `outputs` definition in your site configuration.
|
||||
{{% /note %}}
|
||||
|
||||
## Output format definitions
|
||||
|
||||
|
@ -14,7 +14,7 @@ aliases: [/faq/]
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
**Note:** The answers/solutions presented below are short, and may not be enough to solve your problem. Visit [Hugo Discourse](https://discourse.gohugo.io/) and use the search. It that does not help, start a new topic and ask your questions.
|
||||
The answers/solutions presented below are short, and may not be enough to solve your problem. Visit [Hugo Discourse](https://discourse.gohugo.io/) and use the search. It that does not help, start a new topic and ask your questions.
|
||||
{{% /note %}}
|
||||
|
||||
## I can't see my content
|
||||
|
Loading…
x
Reference in New Issue
Block a user