mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
tpl/tplimpl: Optionally exclude content from sitemap
Define global inclusion/exclusion in site configuration, and override via front matter. For example, to exclude a page from the sitemap: [sitemap] disable = true # default is false Closes #653 Closes #12282 Co-authored-by: kolappannathan <kolappannathan@users.noreply.github.com> Co-authored-by: felicianotech <FelicianoTech@gmail.com>
This commit is contained in:
parent
2f7df4b926
commit
6738a3e79d
6 changed files with 62 additions and 8 deletions
|
@ -108,11 +108,12 @@ outputs: [ "html", "amp" ]
|
|||
|
||||
func TestParseSitemap(t *testing.T) {
|
||||
t.Parallel()
|
||||
expected := config.SitemapConfig{Priority: 3.0, Filename: "doo.xml", ChangeFreq: "3"}
|
||||
expected := config.SitemapConfig{ChangeFreq: "3", Disable: true, Filename: "doo.xml", Priority: 3.0}
|
||||
input := map[string]any{
|
||||
"changefreq": "3",
|
||||
"priority": 3.0,
|
||||
"disable": true,
|
||||
"filename": "doo.xml",
|
||||
"priority": 3.0,
|
||||
"unknown": "ignore",
|
||||
}
|
||||
result, err := config.DecodeSitemap(config.SitemapConfig{}, input)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue