Replacing slug for sitemap

I’m using the ghost API to pull in my post and page data. This then gets rendered within a VueJS app I have. The URLs are consistent. So far, everything is working well, with the exception of the sitemap. I’d like to leverage ghost’s sitemap - but rewrite the “slug”.

I have slug configured as “our-blog” in Ghost, but the VueJS app renders the posts with “blog” in the URL in place of “our-blog”.

In the sitemap, the slug is being written as “our-blog.” Is there anyway to overwrite this? Even hacks/short term fixes are welcome.

Are you asking how to customize the URL for /sitemap.xml?

Yes, customize the urls generated in the sitmap.xml itself.

You could create your own template to generate sitemap.xml and then use routes.yaml to route sitemaps.xml to the custom template.

But first, consider using gctools find-replace tool to rename all your slugs in Ghost to make things consistent.

1 Like