Skip to content

Commit d1c3cef

Browse files
committed
Update main sitemap layout
Signed-off-by: Ian Maddaus <[email protected]>
1 parent 5796d17 commit d1c3cef

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

config/_default/params.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ menuOrder = [
2121
enable_search = true
2222
robots = ''
2323

24+
# sitemaps lists sitemaps that are indexed by the main sitemap layout.
25+
# see:
26+
# - layouts/_default/sitemap.xml
27+
# - layouts/_default/home.sitemap-main.xml
28+
2429
sitemaps = [
2530
"https://docs.chef.io/sitemap-main.xml",
2631
"https://docs.chef.io/360/1.0/sitemap.xml",

generated/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Config file for generated dir.
22

3-
disableKinds = [ "sitemap", "taxonomy", "term", "RSS", "sitemap"]
3+
disableKinds = [ "sitemap", "taxonomy", "term", "RSS"]
44
publishDir = "generated_content"
55

66
[module]
Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
1+
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
33
xmlns:xhtml="http://www.w3.org/1999/xhtml">
4-
{{ range where .Pages "Sitemap.Disable" "ne" true }}
5-
{{- if .Permalink -}}
6-
<url>
7-
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
8-
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
9-
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
10-
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
11-
<xhtml:link
12-
rel="alternate"
13-
hreflang="{{ .Language.LanguageCode }}"
14-
href="{{ .Permalink }}"
15-
/>{{ end }}
16-
<xhtml:link
17-
rel="alternate"
18-
hreflang="{{ .Language.LanguageCode }}"
19-
href="{{ .Permalink }}"
20-
/>{{ end }}
21-
</url>
22-
{{- end -}}
23-
{{ end }}
4+
{{ range .Site.Pages }}
5+
{{- if or (eq (isset .Params "sitemapexclude") false) (ne .Params.sitemapExclude true) }}
6+
<url>
7+
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
8+
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
9+
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
10+
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
11+
<xhtml:link
12+
rel="alternate"
13+
hreflang="{{ .Language.Lang }}"
14+
href="{{ .Permalink }}"
15+
/>{{ end }}
16+
<xhtml:link
17+
rel="alternate"
18+
hreflang="{{ .Language.Lang }}"
19+
href="{{ .Permalink }}"
20+
/>{{ end }}
21+
</url>
22+
{{- end }}
23+
{{ end }}
2424
</urlset>
25-
<!-- hello -->
25+
26+
<!-- From https://dereckcurry.com/posts/excluding-pages-from-the-sitemap/ -->

layouts/_default/sitemap.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
</sitemap>
77
{{ end -}}
88
</sitemapindex>
9+
10+
<!-- https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps -->
11+
<!-- https://swiftype.com/documentation/site-search/crawler-configuration/sitemap -->

0 commit comments

Comments
 (0)