webdiscus / html-bundler-webpack-plugin

Renders Eta, EJS, Handlebars, Nunjucks, Pug, Twig templates "out of the box". Uses HTML template as entry point. Resolves source files of scripts, styles, images in HTML. Supports for Vue.
ISC License
119 stars 12 forks source link

[FEATURE REQUEST]: Add option to dynamically generate a sitemap.xml #91

Open Paillat-dev opened 2 months ago

Paillat-dev commented 2 months ago

Feature request

What is motivation or use case for adding/changing the behaviour? Having an option to have the plugin generate dynamically a sitemap.xml file containing all files / all files matching some criteria.

Describe the solution you'd like I don't really have any syntax idea.

Describe alternatives you've considered Just doing it manually, it's okay as long as there aren't too many pages.

webdiscus commented 2 months ago

Hallo @Paillat-dev,

thanks for the feature request.

The plugin is ready to write own plugin or callback to generate a tree of the used resources.

  1. you can use the verbose: true options to display all processed resources in terminal output
  2. you can use the afterEmit callback or hook where you have full list of all resources used in all entrypoints.
  3. you can see how you can write own plugin for the plugin using the afterEmit hook or afterEmit callback. In this example is a simple implementation of a manifest. Easily you can adapt it to generate a sitemap.xml.

Тo be honest, the last time I generated a sitemap.xml was more than 15 years ago ;-) Who use it today?

Paillat-dev commented 2 months ago

I mean I would answer myself, but more seriously, it is still somewhat relevant for search engines, and cand speed up indexation quite a bit when it's used, at least from what I noticed. I'll see what I can do with that and maybe reply here, or even open a pr. Thanks for the info!

webdiscus commented 2 months ago

The only thing that is not contained in the list are static resources that have not been processed and links to pages. But it can by crawled and tricky cached using the sources option.