Exclude taxonomy page from sitemap

I want to exclude example.com/category/ from sitemap. How to do it? I am using front-matter param for other areas.

Have a look at this topic:

1 Like

This is my code. How do I use that code in this? I have pluralizeListTitles = false in config.toml.

{{ 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 .Pages }}
    {{- if or (eq (isset .Params "exclude_sitemap") false) (ne .Params.exclude_sitemap true) }}
  <url>
    <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
    <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T09:00MST" ) }}</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>

I suggest that you do the following

.Data.Plural is different than pluralizeListTitles

How to combine {{ if not (in .Site.Params.taxonomiesExcludedFromSitemap .Data.Plural) }} and {{- if or (eq (isset .Params "exclude_sitemap") false) (ne .Params.exclude_sitemap true) }} is what I need help with.

Figured it out from here.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.