-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When setting permalink to false using Directory Data Files, exclude such items from tag collection #1251
Comments
@makkabi raised this issue on DEV.to as well. |
I think there are usecases where you want to set permalink to false, but still NOT exclude the content from collections. For example, you could have a folder with "testimonials", and while you don't want to generate single pages for every testimonial (which you can do by setting permalink to false), you still want to have a collection with all testimonials, so you can display them on e.g. your frontpage. |
Drafts are discussed in this feature request / issue. @hirusi for your case, you can additionally set eleventyExcludeFromCollections wherever you set |
@edwardhorsford Thanks! If you would not set eleventyExcludeFromCollections directly to false, but use eleventyComputed to either set it to true or false, based on whether there is a frontmatter of draft: true AND you are in production mode. If you then also use eleventyComputed to set permalink to false, as described by @hirusi in her dev.to post, you pretty much have a draft status feature. |
Here's how I use them - I reference a env var that determines whether they're true or not - no need for I would say they're not quite a substitute for draft. Even with |
@edwardhorsford Thanks! In the end all the discussed solutions are workarounds for a very basic feature, and I hope that 11ty will soon have a built-in (and optimized) way to do this. |
#188 is the home base for this one |
Describe the bug
I use a directory data file to set blog posts or pages to
permalink: false
to exclude them from build on production, if the file is marked as a draft in my Git-based CMS.The files marked as
draft: true
correctly get assigned the computed property ofpermalink: false
. However, if accessing the collection using the following syntax, they are still included in this collection:As a temporary workaround, I also check the permalink value manually:
To Reproduce
Steps to reproduce the behavior:
posts
with blog posts written in Markdown inside itposts.11tydata.js
permalink
tofalse
on some blog posts based on your own criteriacollections[tag_name]
syntax.Expected behavior
collections[tag_name] should exclude files that have
permalink
set tofalse
.Environment:
The text was updated successfully, but these errors were encountered: