mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
✨ Feat: optionally exclude content from sitemap
This commit is contained in:
@@ -197,6 +197,7 @@ enableEmoji = true
|
||||
|
||||
[sitemap]
|
||||
changefreq = "weekly"
|
||||
disable = false
|
||||
filename = "sitemap.xml"
|
||||
priority = 0.5
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- .Scratch.Set "version" "v0.3.13-95436c11" -}}
|
||||
{{- .Scratch.Set "version" "v0.3.13-b32f1a99" -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
+11
-46
@@ -1,47 +1,12 @@
|
||||
<urlset
|
||||
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
>
|
||||
{{- range (where .Data.Pages "Section" "!=" "gallery") -}}
|
||||
<url>
|
||||
<loc>
|
||||
{{- .Permalink -}}
|
||||
</loc>
|
||||
{{- if not .Lastmod.IsZero -}}
|
||||
<lastmod>
|
||||
{{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}}
|
||||
</lastmod>
|
||||
{{- end -}}
|
||||
{{- with .Sitemap.ChangeFreq -}}
|
||||
<changefreq>
|
||||
{{- . -}}
|
||||
</changefreq>
|
||||
{{- end -}}
|
||||
|
||||
{{- if ge .Sitemap.Priority 0.0 -}}
|
||||
{{- $weeks := div (sub now.Unix .Lastmod.Unix) 604800 -}}
|
||||
{{- $priority := sub 1 (div $weeks 10.0 ) -}}
|
||||
{{- if ge .Sitemap.Priority $priority -}}
|
||||
<priority>{{ .Sitemap.Priority }}</priority>
|
||||
{{- else -}}
|
||||
<priority>{{ $priority }}</priority>
|
||||
{{- end -}}
|
||||
{{- 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 -}}
|
||||
{{ 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">
|
||||
{{- range where .Pages "Sitemap.Disable" "ne" true -}}{{ if .Permalink }}
|
||||
<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="{{ .Language.LanguageCode }}" href="{{ .Permalink }}"/>{{ end }}
|
||||
<xhtml:link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ .Permalink }}"/>{{ end }}
|
||||
</url>{{ end }}{{ end }}
|
||||
</urlset>
|
||||
|
||||
Reference in New Issue
Block a user