Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ menuOrder = [
"legacy",
"extra"
]

enable_search = true
robots = ''

# sitemaps lists sitemaps that are indexed by the main sitemap layout.
# see:
# - layouts/_default/sitemap.xml
# - layouts/_default/home.sitemap-main.xml

sitemaps = [
"https://docs.chef.io/sitemap-main.xml",
"https://docs.chef.io/360/1.0/sitemap.xml"
]

[chef-web-docs]
gh_path = "https://github.com/chef/chef-web-docs/blob/main/content/"

Expand Down
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
30 changes: 20 additions & 10 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,34 @@ pluralizeListTitles = false
disableKinds = ["taxonomy", "term"]
configDir = "config"

# We do redirects using Netlify's _redirects file, generated by Hugo (see "outputs" below).
disableAliases = true
# Summary length
summaryLength = 20

# We do redirects using Netlify's _redirects file, generated by Hugo.
# See the REDIR output and output format and the text/netlify mediatype.
[outputs]
home = [ "HTML", "RSS", "REDIR" ]
section = [ "HTML", "RSS" ]
home = [ "HTML", "RSS", "REDIR", "SITEMAP-MAIN" ]
section = [ "HTML", "RSS" ]

[mediaTypes]
[mediaTypes."text/netlify"]
delimiter = ""
[mediaTypes."text/netlify"]
delimiter = ""

[outputFormats]
[outputFormats.REDIR]
mediatype = "text/netlify"
baseName = "_redirects"
isPlainText = true
notAlternative = true
[outputFormats.REDIR]
mediatype = "text/netlify"
baseName = "_redirects"
isPlainText = true
notAlternative = true

[outputFormats.SITEMAP-MAIN]
MediaType = "application/xml"
BaseName = "sitemap-main"
IsHTML = false
IsPlainText = true
Rel = "sitemap"
protocol = "xml://"

[markup]
[markup.goldmark]
Expand Down
26 changes: 26 additions & 0 deletions layouts/_default/home.sitemap-main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{ 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 .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>

<!-- From https://dereckcurry.com/posts/excluding-pages-from-the-sitemap/ -->
11 changes: 11 additions & 0 deletions layouts/_default/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{- range .Site.Params.sitemaps }}
<sitemap>
<loc>{{ . }}</loc>
</sitemap>
{{ end -}}
</sitemapindex>

<!-- https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps -->
<!-- https://swiftype.com/documentation/site-search/crawler-configuration/sitemap -->
Loading