Sitemap Plugin
Description
Hello, Vike Community! I'm in search of a sitemap plugin to enhance our project and was wondering if such a feature already exists.
If not, I'd be grateful for any guidance or suggestions on how to elegantly implement this.
Thank you in advance for your time and assistance!
What exactly do you mean with sitemap? Do you mean example.org/sitemap.xml? What's your motivation?
Yeah, sitemap.xml. I have ssr({prerender: true}) and a lot of html files after build phase, so I want to get somehow sitemap.xml after build step too.
How about a prerender: { sitemap: true } option? Would you be up for a PR?
What's your motivation?
For SEO or other purposes as well? Is it still relevant to have a sitemap.xml for SEO?
Would you be up for a PR?
Yeah, I'm ready to get involved
What's your motivation?
In my particular case, I need it for SEO, yes. I want to feed the file into Google Search Console:
👍 Looking forward to it.
Could you suggest suitable internal APIs from Vike? What would it look like in theory?
I'm asking because I'm not familiar with the Vike structure.
See runPrerender.ts. If you prefer you can write a script you run after an one of the example's $ vite build (e.g. /examples/{react,vue}-full and I'll do the integration of your script into Vike. Whichever you prefer.
@mikhin if you want some code for a script that should work with minor adjustments feel free to take from https://github.com/Idrinth/react-file-based-routes/blob/master/src/generate-routes.ts - would be happy if vike would support sitemaps out of the box.
Required adjustments:
- point to dist instead of src
- look for .html files instead of .tsx
- possibly adjust the mapping object
Sounds great, thanks for the tip!