jsakamoto / BlazorWasmPreRendering.Build

When you publish your Blazor Wasm app, this package pre-renders and saves the app as static HTML files in your public folder.
https://jsakamoto.github.io/BlazorWasmPreRendering.Build/
Mozilla Public License 2.0
261 stars 15 forks source link

Sitemap #3

Closed NArnott closed 3 years ago

NArnott commented 3 years ago

Any chance we could get a sitemap to go with this? Something simple that just lists the pages in a sitemap.xml file would be good first step.

https://developers.google.com/search/docs/advanced/sitemaps/build-sitemap

jsakamoto commented 3 years ago

Hum...

How do you think about what can this package do to generate a sitemap.xml automatically?

For example, I have a question: how can this package determine a <lastmod> date value inside a sitemap.xml.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>http://www.example.com/foo.html</loc>
    <lastmod>2018-06-04</lastmod> <!-- 👈 How to determine this date! -->
  </url>
</urlset>

Could you tell me more details of your idea if you have concrete it?

NArnott commented 3 years ago

I'm thinking using various lastmoddate attributes may help with this.

The nature of a blazor page is such that a lastmod date may not always make sense. In cases where it doesn't, just don't provide a lastmod date by decorating the page with a NoLastModDateAttribute.

In cases where a lastmod date does make sense, maybe provide different attributes for that implement different strategies for obtaining the date. For example, one such attribute could get the date based on the OS's last modified date for the cshtml file. Another could just be a custom attribute where the developer provides a custom static method that will provide the date some other way.

jsakamoto commented 3 years ago

Thanks for the reply!

Well, the idea you explained is interesting, but I feel it is a little bit complicated for me.

And, I think the feature that generating sitemap.xml in a build process is out of this package's responsible area.

In my opinion, that's feature should consist of an individual package because the theme that generating sitemap.xml will have various consideration points, and I'm guessing it will take a lot of implementations.

So, I'm sorry, but I think including the auto-generating sitemap.xml feature into this package is not a good idea.

I appreciate it if you agree with my opinion.

NArnott commented 3 years ago

I appreciate your position. Thanks for your consideration.