From abf336fa9fb2776abc223556fc5c2aec0668a762 Mon Sep 17 00:00:00 2001 From: Tixie Date: Mon, 23 Dec 2019 08:53:35 +0100 Subject: [PATCH] feat: Remove admin url from sitemap --- content/admin.md | 1 + layouts/_default/sitemap.xml | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 layouts/_default/sitemap.xml diff --git a/content/admin.md b/content/admin.md index 1a2bfdc..5fdfbfc 100644 --- a/content/admin.md +++ b/content/admin.md @@ -2,4 +2,5 @@ title: "test" type: admin layout: admin +sitemapexclude: true --- diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml new file mode 100644 index 0000000..43ec271 --- /dev/null +++ b/layouts/_default/sitemap.xml @@ -0,0 +1,24 @@ +{{ printf "" | safeHTML }} + +{{ range .Data.Pages }} + {{- if or (eq (isset .Params "sitemapexclude") false) (ne .Params.sitemapExclude true) }} + + {{ .Permalink }}{{ if not .Lastmod.IsZero }} + {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}{{ end }}{{ with .Sitemap.ChangeFreq }} + {{ . }}{{ end }}{{ if ge .Sitemap.Priority 0.0 }} + {{ .Sitemap.Priority }}{{ end }}{{ if .IsTranslated }}{{ range .Translations }} + {{ end }} + {{ end }} + + {{- end }} +{{ end }} +