From 8c4f720048c0187b203ca869befd759249bac79f Mon Sep 17 00:00:00 2001 From: Spencer Smith Date: Fri, 1 Apr 2022 12:07:43 -0400 Subject: [PATCH] docs: override sitemap.xml to only include latest results This PR overrides the sitemap to only include, for example, v1.0 results if that's our specified latest version. This should fix Google's indexing of our docs to only include the latest results. Signed-off-by: Spencer Smith --- website/layouts/sitemap.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 website/layouts/sitemap.xml diff --git a/website/layouts/sitemap.xml b/website/layouts/sitemap.xml new file mode 100644 index 000000000..49f19c4c3 --- /dev/null +++ b/website/layouts/sitemap.xml @@ -0,0 +1,12 @@ +{{ printf "" | safeHTML }} + + {{- range .Data.Pages -}}{{ $currentVersion := index (split .Permalink "/" ) 1 }}{{ $currentVersionDir := $currentVersion | printf "/%s"}}{{ if and .Permalink (ne .Params.sitemap_exclude true) (eq $currentVersionDir site.Params.url_latest_version)}} + + https://talos.dev{{ .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 }} +