hexojs / hexo-generator-sitemap

Sitemap generator for Hexo.
https://hexo.io
MIT License
294 stars 54 forks source link

dynamically generated pages are not included in the sitemap #153

Open lgradzki-cksource opened 1 year ago

lgradzki-cksource commented 1 year ago

generating blog author pages

hexo.extend.generator.register(
    'authors',
    function (locals) {

        authorsData = ['array of data'];

        return authorsData.reduce((result, author) => {
            const data = pagination(
                '/blog/authors/' + author.slug,
                author.posts,
                {
                    layout: ['page'],
                    perPage: 10,
                    data: {
                        title: author.name ,
                    },
                }
            );

            return result.concat(data);
        }, []);
    },
    1
);

seems like pages generated dynamically with the code above are not included in the sitemap plugin output

is it that the moment the plugin is registered the newly created pages are not there yet? vide https://github.com/hexojs/hexo-generator-sitemap/blob/master/lib/generator.js#L23

note: pages are properly generated and are fully functional

any feedback is highly appreciated 🙇

uiolee commented 1 year ago

My understanding is that the generator just generate a file. The generator does not declare this file as page or post. So this file does not belong to the pages or posts.

lgradzki-cksource commented 1 year ago

@uiolee exactly it is a dynamically generated file based on the data fetched from the CMS that is pushed to production as a standalone .html page and therefore it would be great if it was reflected in the sitemap.xml