quasibit / eleventy-plugin-sitemap

Eleventy plugin to generate a sitemap.
MIT License
39 stars 7 forks source link

Tried to use templateContent too early with v3.0.0-alpha #82

Open krisdahl opened 2 months ago

krisdahl commented 2 months ago

Error

Having trouble rendering njk template ./templates/sitemap.njk (via TemplateContentRenderError) Tried to use templateContent too early on ./templates/labpost.njk (via TemplateContentPrematureUseError) Original error stack trace: TemplateContentPrematureUseError: Tried to use templateContent too early on ./templates/template.njk at Object.get [as templateContent] (file:///[path]/node_modules/@11ty/eleventy/src/Template.js:618:14) at [path]/node_modules/@quasibit/eleventy-plugin-sitemap/src/paginationItems.js:20:5

I'm getting an error using the plain vanilla copy paste from documents. It seems to have something to do with the pagination of the collections. I tried to use eleventyImport to make sure the collections were loaded explictly without a difference.

I also tried creating a custom sitemap collection and use that but also got the error.

eleventy version 3.0.0-alpha.19, sitemap 2.2.0

krisdahl commented 2 months ago

To workaround I manually did a sitemap template based on this recipie: https://11ty.recipes/recipes/add-a-sitemap/