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

[New Feature Request] Automatically set lastmod in sitemap #22

Open
Glench opened this issue Jan 27, 2022 · 2 comments
Open

[New Feature Request] Automatically set lastmod in sitemap #22

Glench opened this issue Jan 27, 2022 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Glench
Copy link

Glench commented Jan 27, 2022

It'd be great if this library could automatically fill in the <lastmod> time in the generated sitemap based on either the datetime the source route file was modified (probably won't work if you clone a fresh git repo since all files will have the same datetime?) or maybe the datetime the file was last modified in git or something.

@bartholomej bartholomej added the enhancement New feature or request label Jan 28, 2022
@bartholomej
Copy link
Owner

This is a little bit tricky, because the sitemap is generated on postbuild hook, so it is always based on newly generated static files.
There would have to be some mapping to the original files...

And there are also dynamically generated routes [slug].svelte, from which date information cannot be taken.

Another thing is that the route itself often consists of a child component. So there would have to be complex traversal to other files as well.

In summary, I would say that this solution will never be completely reliable and is not worth the effort 🤨
Let's keep it simple 😄

Or do you have a better idea? I'd love to hear it.

@bartholomej bartholomej added the help wanted Extra attention is needed label Jan 28, 2022
@Glench
Copy link
Author

Glench commented Jan 28, 2022

Yeah, that all makes sense. And yeah, too complicated. Thanks for considering it.

What about my other idea of introspecting git information? Git already has a diffing mechanism for static files so you could perhaps get the last time each build/**.html file was modified in git and put that in the sitemap? Maybe a --use-git-lastmod option?

It would be a little unfortunate that this feature would only work with projects that are stored in Git, but for me it would be better than manually updating the <lastmod> fields every time.

@Glench Glench changed the title [New Feature Request] Automatically set lastmod by looking up mtime of /src/routes/*.svelte [New Feature Request] Automatically set lastmod in sitemap Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants