mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Merge commit 'cf591b7c0c598d34896709db6d28598da37e3ff6'
This commit is contained in:
@@ -16,7 +16,7 @@ aliases: []
|
||||
toc: false
|
||||
---
|
||||
|
||||
When using Hugo with [GitHub Pages](https://pages.github.com/), you can provide your own template for a [custom 404 error page](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site) by creating a 404.html template file in your `/layouts` folder. When Hugo generates your site, the `404.html` file will be placed in the root.
|
||||
When using Hugo with [GitHub Pages](https://pages.github.com/), you can provide your own template for a [custom 404 error page](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site) by creating a 404.html template file in the root of your `layouts` folder. When Hugo generates your site, the `404.html` file will be placed in the root.
|
||||
|
||||
404 pages will have all the regular [page variables][pagevars] available to use in the templates.
|
||||
|
||||
|
@@ -496,7 +496,17 @@ Will render `Bonsoir, Eliott.`, and not care about the syntax error (`add 0 + 2`
|
||||
|
||||
### HTML comments
|
||||
|
||||
If you need to produce HTML comments from your templates, take a look at the [Internet Explorer conditional comments]({{< relref "introduction.md#ie-conditional-comments" >}}) example. If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`. For example:
|
||||
You can add html comments by piping a string HTML code comment to `safeHTML`.
|
||||
|
||||
For example:
|
||||
|
||||
```go-html-template
|
||||
{{ "<!-- This is an HTML comment -->" | safeHTML }}
|
||||
```
|
||||
|
||||
If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`.
|
||||
|
||||
For example:
|
||||
|
||||
```go-html-template
|
||||
{{ printf "<!-- Our website is named: %s -->" .Site.Title | safeHTML }}
|
||||
|
Reference in New Issue
Block a user