I am sorry if this has been already answered. I have recently migrated my website from Wordpress to Ghost. Everything is perfect! But I have one problem: I am new to Node.JS and I have absolutely no idea how I can implement a news sitemap for my website. Can anyone please point me in the right direction?
Website URL: https://hackhex.com/
Best regards.
Edit:
Nevermind, I figured it.
-
Add this to your route.yml:
/news/sitemap/:
permalink: /news/sitemap/
template: news -
Add news.hbs to your theme folder:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
{{#get "posts" limit="3"}}
{{#foreach posts}}
<url>
<loc>{{url absolute="true"}}</loc>
<news:news>
<news:publication>
<news:name>Hack Hex</news:name>
<news:language>en</news:language>
</news:publication>
<news:publication_date>{{date format="YYYY-MM-DD"}}</news:publication_date>
<news:title>{{title}}</news:title>
</news:news>
</url>
{{/foreach}}
{{/get}}
</urlset>