Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemap Plugin #1451

Open
mikhin opened this issue Jan 21, 2024 · 9 comments
Open

Sitemap Plugin #1451

mikhin opened this issue Jan 21, 2024 · 9 comments
Labels
enhancement ✨ New feature or request

Comments

@mikhin
Copy link

mikhin commented Jan 21, 2024

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!

@mikhin mikhin added the enhancement ✨ New feature or request label Jan 21, 2024
@brillout
Copy link
Member

What exactly do you mean with sitemap? Do you mean example.org/sitemap.xml? What's your motivation?

@mikhin
Copy link
Author

mikhin commented Jan 21, 2024

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.

@brillout
Copy link
Member

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?

@mikhin
Copy link
Author

mikhin commented Jan 21, 2024

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:

Screenshot 2024-01-21 at 21 11 33

@brillout
Copy link
Member

👍 Looking forward to it.

@mikhin
Copy link
Author

mikhin commented Jan 21, 2024

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.

@brillout
Copy link
Member

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.

@Idrinth
Copy link

Idrinth commented Jan 24, 2024

@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

@mikhin
Copy link
Author

mikhin commented Jan 24, 2024

Sounds great, thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants