diff options
author | Max Mehl <mail@mehl.mx> | 2020-11-03 11:22:24 +0300 |
---|---|---|
committer | Max Mehl <mail@mehl.mx> | 2020-11-03 11:22:24 +0300 |
commit | 9d6822b6fe06804f3b2637352b100b980eb77a69 (patch) | |
tree | cd8b0510fad9c355f4b8c6388580f26c49b8d385 | |
parent | 055443ac8c8f44f487d05421dcac98cabc2f71d2 (diff) |
allow to hide content from sitemap
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | layouts/sitemap.xml | 23 |
2 files changed, 24 insertions, 0 deletions
@@ -176,6 +176,7 @@ widgets: # Enable sidebar widgets in given order per page - "search" - "recent" - "taglist" +sitemap_hide: false # Do not add this page to the sitemap --- ``` diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml new file mode 100644 index 0000000..5973853 --- /dev/null +++ b/layouts/sitemap.xml @@ -0,0 +1,23 @@ +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + {{- range .Data.Pages -}} + {{ if ne .Params.sitemap_hide true }} + <url> + <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} + <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }} + <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }} + <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }} + <xhtml:link + rel="alternate" + hreflang="{{ .Lang }}" + href="{{ .Permalink }}" + />{{ end }} + <xhtml:link + rel="alternate" + hreflang="{{ .Lang }}" + href="{{ .Permalink }}" + />{{ end }} + </url> + {{ end }} + {{- end -}} +</urlset> |