Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'

This commit is contained in:
Bjørn Erik Pedersen
2022-11-17 16:16:19 +01:00
217 changed files with 2437 additions and 2821 deletions

View File

@@ -18,19 +18,19 @@ toc: true
## Template Metrics
Hugo is a very fast static site generator, but it is possible to write
inefficient templates. Hugo's *template metrics* feature is extremely helpful
inefficient templates. Hugo's _template metrics_ feature is extremely helpful
in pinpointing which templates are executed most often and how long those
executions take **in terms of CPU time**.
| Metric Name | Description |
|---------------------|-------------|
| cumulative duration | The cumulative time spent executing a given template. |
| average duration | The average time spent executing a given template. |
| Metric Name | Description |
| ------------------- | -------------------------------------------------------------- |
| cumulative duration | The cumulative time spent executing a given template. |
| average duration | The average time spent executing a given template. |
| maximum duration | The maximum time a single execution took for a given template. |
| count | The number of times a template was executed. |
| template | The template name. |
| count | The number of times a template was executed. |
| template | The template name. |
```
```txt
▶ hugo --templateMetrics
Started building sites ...
@@ -77,20 +77,18 @@ simultaneously. Because of this parallelism, the sum of "cumulative duration"
values is usually greater than the actual time it takes to build a site.
{{% /note %}}
## Cached Partials
Some `partial` templates such as sidebars or menus are executed many times
during a site build. Depending on the content within the `partial` template and
during a site build. Depending on the content within the `partial` template and
the desired output, the template may benefit from caching to reduce the number
of executions. The [`partialCached`][partialCached] template function provides
of executions. The [`partialCached`][partialcached] template function provides
caching capabilities for `partial` templates.
{{% tip %}}
Note that you can create cached variants of each `partial` by passing additional
parameters to `partialCached` beyond the initial context. See the
parameters to `partialCached` beyond the initial context. See the
`partialCached` documentation for more details.
{{% /tip %}}
[partialCached]:{{< ref "/functions/partialCached.md" >}}

View File

@@ -19,9 +19,9 @@ aliases: [/faq/]
## I can't see my content!
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 [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.
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?
@@ -35,7 +35,9 @@ Yes you can! See [Configure with Environment Variables](/getting-started/configu
How to automate the "publish at intervals" part depends on your situation:
* If you deploy from your own PC/server, you can automate with [Cron](https://en.wikipedia.org/wiki/Cron) or similar.
* If your site is hosted on a service similar to [Netlify](https://www.netlify.com/) you can use a service such as [ifttt](https://ifttt.com/date_and_time) to schedule the updates.
* If your site is hosted on a service similar to [Netlify](https://www.netlify.com/) you can:
* Use a service such as [ifttt](https://ifttt.com/date_and_time) to schedule the updates
* Set up a deploy hook which you can run with a cron service to deploy your site at intervals, such as [cron-job.org](https://cron-job.org/) (both Netlify and Cloudflare Pages support deploy hooks)
Also see this Twitter thread:
@@ -49,7 +51,7 @@ Yes you can! Read [this](/hosting-and-deployment/hosting-on-netlify/#configure-h
## I get "... this feature is not available in your current Hugo version"
If you process `SCSS` or `SASS` to `CSS` in your Hugo project with `libsass` as the transpiler or if you convert images to the `webp` format, you need the Hugo `extended` version, or else you may see an error message similar to the below:
If you process `SCSS` or `Sass` to `CSS` in your Hugo project with `libsass` as the transpiler or if you convert images to the `webp` format, you need the Hugo `extended` version, or else you may see an error message similar to the below:
```bash
error: failed to transform resource: TOCSS: failed to transform "scss/main.scss" (text/x-scss): this feature is not available in your current Hugo version
@@ -58,14 +60,3 @@ error: failed to transform resource: TOCSS: failed to transform "scss/main.scss"
We release two set of binaries for technical reasons. The extended version is not what you get by default for some installation methods. On the [release page](https://github.com/gohugoio/hugo/releases), look for archives with `extended` in the name. To build `hugo-extended`, use `go install --tags extended`
To confirm, run `hugo version` and look for the word `extended`.
## Do I need to install Git to create, deploy, and maintain a website with Hugo?
>Technically, no.
>
>Practically, yes.
* The primary installation method documented by most (perhaps all) themes is via Git or the Hugo Modules feature.
* The Hugo Modules feature requires Go, and Go “gets” with Git.
* A Git repository is required by CI/CD hosting (Bitbucket, Cloudflare, GitHub Pages, GitLab Pages, Netlify, et. al.).
* The canonical “last modified” date for content is its Git committer date; using anything else is error-prone.