Closed adamwolf closed 3 weeks ago
I ended up working around this with something like the following:
---js
{
pagination: {
data: "collections",
size: 1,
addAllPagesToCollections: true,
alias: "tag",
filter: [
"all",
],
before: function(paginationData, fullData) {
// Filter out collections that don't have any items. (This fixes an issue where draft entry tags are included in production builds.)
return paginationData.filter(entry => fullData.collections[entry].length > 0);
},
},
permalink: "tags/{{ tag | slugify}}/",
eleventyComputed: {
title: data => `Tagged “${data.tag}”`,
},
layout: "layouts/blank.njk",
}
---
You could also use:
eleventyExcludeFromCollections: true
: https://www.11ty.dev/docs/collections/#how-to-exclude-content-from-collectionsThis is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.
If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and we will reopen the issue. Thanks!
When I add a tag to fifthpost.md with
tags: hello
, tags.njk generates a page for the hello tag at_site/tags/hello/index.html
.It doesn't show up in the loop in tags-list.njk, which is nice.
Is there a good way to not include draft tags in that pagination?
(I tried to dig into this a bit but I have to admit that although it works fine for me whenever I'm doing anything normal, I don't have my head around nitty gritty of how page data is processed.)