specific categories to sitemap instead of "category:all"
sleepingwheel opened this issue · 2 comments
great work on this.
i have a suggestion & question for sitemap.
Njk template there uses "collections.all" to generate sitemap for all possible pages, like so
---
permalink: sitemap.xml
hidden: true
---
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{%- for page in collections.all %}
{%- if not page.data.hidden %}
<url>
<loc>{{ site.url }}{{ page.url | url }}</loc>
<lastmod>{{ page.date | htmlDateDisplay }}</lastmod>
</url>
{%- endif %}
{%- endfor %}
One of the outputs in a resulting sitemap is
https://skeleventy.netlify.app/category/all/
which is a collection of all possible pages - a bit of a mess for indexing.
Instead of "category all", it would be better that google indexes each category, for example
<url>
<loc>https://skeleventy.netlify.app/category/software/</loc>
<lastmod>2020-7-20</lastmod>
</url>
<url>
<loc>https://skeleventy.netlify.app/category/writing/</loc>
<lastmod>2020-7-20</lastmod>
</url>
But how can i edit that njk template so that it
-captures and outputs different categories in the sitemap?
-excludes category/all
-leaves other important pages like homepage, each blog post etc
thanks again,
Yeah, I'm not sure off the top of my head. I'll have a look into this! 👍
I've managed to get rid of the https://skeleventy.netlify.app/category/all/
from the sitemap.