Skip to content

Commit

Permalink
Update main sitemap layout
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Maddaus <[email protected]>
  • Loading branch information
IanMadd committed Nov 15, 2024
1 parent 5796d17 commit 59e007a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion generated/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Config file for generated dir.

disableKinds = [ "sitemap", "taxonomy", "term", "RSS", "sitemap"]
disableKinds = [ "sitemap", "taxonomy", "term", "RSS"]
publishDir = "generated_content"

[module]
Expand Down
45 changes: 23 additions & 22 deletions layouts/_default/home.sitemap-main.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
{{ 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 }}
{{ range .Site.Pages }}
{{- if or (eq (isset .Params "sitemapexclude") false) (ne .Params.sitemapExclude 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="{{ .Language.Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
<xhtml:link
rel="alternate"
hreflang="{{ .Language.Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
</url>
{{- end }}
{{ end }}
</urlset>
<!-- hello -->

<!-- From https://dereckcurry.com/posts/excluding-pages-from-the-sitemap/ -->

0 comments on commit 59e007a

Please sign in to comment.