hexojs/hexo-generator-sitemap

dynamically generated pages are not included in the sitemap

lgradzki-cksource opened this issue · 2 comments

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

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.

@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