mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -3,33 +3,37 @@ title: Sitemap
|
||||
description: Returns the sitemap settings for the given page as defined in front matter, falling back to the sitemap settings as defined in the site configuration.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: config.SitemapConfig
|
||||
signatures: [PAGE.Sitemap]
|
||||
toc: true
|
||||
params:
|
||||
functions_and_methods:
|
||||
returnType: config.SitemapConfig
|
||||
signatures: [PAGE.Sitemap]
|
||||
---
|
||||
|
||||
Access to the `Sitemap` method on a `Page` object is restricted to [sitemap templates].
|
||||
|
||||
## Methods
|
||||
|
||||
changefreq
|
||||
: (`string`) How frequently a page is likely to change. Valid values are `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, and `never`. With the default value of `""` Hugo will omit this field from the sitemap. See [details](https://www.sitemaps.org/protocol.html#changefreqdef).
|
||||
### ChangeFreq
|
||||
|
||||
(`string`) How frequently a page is likely to change. Valid values are `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, and `never`. With the default value of `""` Hugo will omit this field from the sitemap. See [details](https://www.sitemaps.org/protocol.html#changefreqdef).
|
||||
|
||||
```go-html-template
|
||||
{{ .Sitemap.ChangeFreq }}
|
||||
```
|
||||
|
||||
disable {{< new-in 0.125.0 />}}
|
||||
: (`bool`) Whether to disable page inclusion. Default is `false`. Set to `true` in front matter to exclude the page.
|
||||
### Disable
|
||||
|
||||
{{< new-in 0.125.0 />}}
|
||||
|
||||
(`bool`) Whether to disable page inclusion. Default is `false`. Set to `true` in front matter to exclude the page.
|
||||
|
||||
```go-html-template
|
||||
{{ .Sitemap.Disable }}
|
||||
```
|
||||
|
||||
priority
|
||||
: (`float`) The priority of a page relative to any other page on the site. Valid values range from 0.0 to 1.0. With the default value of `-1` Hugo will omit this field from the sitemap. See [details](https://www.sitemaps.org/protocol.html#priority).
|
||||
### Priority
|
||||
|
||||
(`float`) The priority of a page relative to any other page on the site. Valid values range from 0.0 to 1.0. With the default value of `-1` Hugo will omit this field from the sitemap. See [details](https://www.sitemaps.org/protocol.html#prioritydef).
|
||||
|
||||
```go-html-template
|
||||
{{ .Sitemap.Priority }}
|
||||
@@ -54,7 +58,7 @@ changeFreq = 'hourly'
|
||||
|
||||
And this simplistic sitemap template:
|
||||
|
||||
{{< code file=layouts/_default/sitemap.xml >}}
|
||||
```xml {file="layouts/_default/sitemap.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">
|
||||
@@ -70,7 +74,7 @@ And this simplistic sitemap template:
|
||||
</url>
|
||||
{{ end }}
|
||||
</urlset>
|
||||
{{< /code >}}
|
||||
```
|
||||
|
||||
The change frequency will be `hourly` for the news page, and `monthly` for other pages.
|
||||
|
||||
|
Reference in New Issue
Block a user