kirby3-static-site-generator icon indicating copy to clipboard operation
kirby3-static-site-generator copied to clipboard

Unable to generate sitemap

Open robbertrosario opened this issue 2 years ago • 2 comments

Expected Behavior

I am using this sitemap snippet: https://getkirby.com/docs/cookbook/content/sitemap by Bastian. But it doesn't generate an actual sitemap.xml file it just starts rendering the xml when you access the route.

I've tried using the ready function as per README, but the custom_routes expect a page id, but the above sitemap snippet is not an actual page? and therefore has no page id?

Current Behavior

Sitemap is not generated

Context

Kirby version: 3.7 Plugin version: 1.5.1

Installed using composer

robbertrosario avatar Jul 27 '22 13:07 robbertrosario

To generate a static sitemap I use new Page() in the plugin's config ready option :

// config.php
return [
	'ready' => function() {
		return [
			'd4l.static_site_generator' => [
				'custom_routes' => return [[
					'path' => '/sitemap.xml',
					'page' => new Page([
						'template' => 'sitemap',
						'slug' => 'sitemap',
					]),
				]];
			],
		];
  	}
];

I have a sitemap.php in the template folder, I don't what you should do with your snippet from the cookbook. Creating a sitemap.php template which just calls your snippet should work.

ShallowRed avatar Jul 31 '22 18:07 ShallowRed

That seems to work thanks!

robbertrosario avatar Aug 01 '22 08:08 robbertrosario