Merge commit '35febb2e2a3780c3338a2665fddea7dda28a17f4'

This commit is contained in:
Bjørn Erik Pedersen
2019-07-15 23:50:56 +02:00
42 changed files with 343 additions and 152 deletions

View File

@@ -53,6 +53,7 @@ Your 404.html file can be set to load automatically when a visitor enters a mist
* Amazon CloudFont. You can specify the page in the Error Pages section in the CloudFont Console. [Details here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html)
* Caddy Server. Using `errors { 404 /404.html }`. [Details here](https://caddyserver.com/docs/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).
{{% note %}}
`hugo server` will not automatically load your custom `404.html` file, but you

View File

@@ -137,7 +137,7 @@ description = "Text about this post"
date = "2006-01-02"
images = ["post-cover.png"]
audio = []
video = []
videos = []
series = []
tags = []
{{</ code-toggle >}}
@@ -146,11 +146,14 @@ Hugo uses the page title and description for the title and description metadata.
The first 6 URLs from the `images` array are used for image metadata.
Various optional metadata can also be set:
- Date, published date, and last modified data are used to set the published time metadata if specified.
- `audio` and `video` are URL arrays like `images` for the audio and video metadata tags, respectively.
- `audio` and `videos` are URL arrays like `images` for the audio and video metadata tags, respectively.
- The first 6 `tags` on the page are used for the tags metadata.
- The `series` taxonomy is used to specify related "see also" pages by placing them in the same series.
If using YouTube this will produce a og:video tag like `<meta property="og:video" content="url">`. If using a YouTube link make sure this is in **https://www.youtube.com/v/NlXVWtgLNjY** not __https://www.youtube.com/watch?v=NlXVWtgLNjY__
### Use the Open Graph Template
To add Open Graph metadata, include the following line between the `<head>` tags in your templates:
@@ -160,6 +163,7 @@ To add Open Graph metadata, include the following line between the `<head>` tags
```
## Twitter Cards
An internal template for [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards),
metadata used to attach rich media to Tweets linking to your site.

View File

@@ -170,7 +170,7 @@ Example of including a `layouts/partials/header.html` partial:
### Template
The `template` function was used to include *partial* templates
in much older Hugo versions. Now it useful only for calling
in much older Hugo versions. Now it's useful only for calling
[*internal* templates][internal_templates]. The syntax is `{{ template
"_internal/<TEMPLATE>.<EXTENSION>" . }}`.
@@ -235,7 +235,7 @@ key.
#### Example 5: Conditional on empty _map_, _array_, or _slice_.
If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statment is evaluated.
If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statement is evaluated.
```go-html-template
{{ range $array }}

View File

@@ -35,7 +35,7 @@ For template lookup order, see [Template Lookup](/templates/lookup-order/).
The idea of a list page comes from the [hierarchical mental model of the web][mentalmodel] and is best demonstrated visually:
![Image demonstrating a hierarchical website sitemap.](/images/site-hierarchy.svg)
[![Image demonstrating a hierarchical website sitemap.](/images/site-hierarchy.svg)](/images/site-hierarchy.svg)
## List Defaults

View File

@@ -65,7 +65,7 @@ The following is an example:
{{< /code >}}
{{% note "`absLangURL` and `relLangURL`" %}}
Use the [`absLangUrl`](/functions/abslangurl) or [`relLangUrl`](/functions/rellangurl) functions if your theme makes use of the [multilingual feature](/content-management/multilingual/). In contrast to `absURL` and `relURL`, these two functions add the correct language prefix to the url.
Use the [`absLangURL`](/functions/abslangurl) or [`relLangURL`](/functions/rellangurl) functions if your theme makes use of the [multilingual feature](/content-management/multilingual/). In contrast to `absURL` and `relURL`, these two functions add the correct language prefix to the url.
{{% /note %}}
## Section Menu for Lazy Bloggers

View File

@@ -47,7 +47,7 @@ To add or modify a media type, define it in a `mediaTypes` section in your [site
The above example adds one new media type, `text/enriched`, and changes the suffix for the built-in `text/html` media type.
**Note:** these media types are configured for **your output formats**. If you want to redefine one of Hugo's default output formats (e.g. `HTML`), you also need to redefine the output format. So, if you want to change the suffix of the `HTML` output format from `html` (default) to `htm`:
**Note:** these media types are configured for **your output formats**. If you want to redefine one of Hugo's default output formats (e.g. `HTML`), you also need to redefine the media type. So, if you want to change the suffix of the `HTML` output format from `html` (default) to `htm`:
```toml
[mediaTypes]

View File

@@ -58,6 +58,7 @@ copyright = "This work is licensed under a Creative Commons Attribution-ShareAli
This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.0 Specification][RSS 2.0].
```xml
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
@@ -86,13 +87,6 @@ This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.
</rss>
```
{{% warning "XML Header" %}}
Hugo will automatically add the following header line to this file on render. Please do *not* include this in the template as it's not valid HTML.
```
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
```
{{% /warning %}}
## Reference your RSS Feed in `<head>`
In your `header.html` template, you can specify your RSS feed in your `<head></head>` tag using Hugo's [Output Formats][Output Formats] like this:

View File

@@ -46,6 +46,7 @@ For multilingual sites, we also create a Sitemap index. You can provide a custom
This template respects the version 0.9 of the [Sitemap Protocol](http://www.sitemaps.org/protocol.html).
```xml
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
@@ -69,18 +70,12 @@ This template respects the version 0.9 of the [Sitemap Protocol](http://www.site
</urlset>
```
{{% note %}}
Hugo will automatically add the following header line to this file
on render. Please don't include this in the template as it's not valid HTML.
`<?xml version="1.0" encoding="utf-8" standalone="yes" ?>`
{{% /note %}}
## Hugo's sitemapindex.xml
This is used to create a Sitemap index in multilingual mode:
```xml
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ range . }}
<sitemap>