re-add support for 'unpublished: true'

This commit is contained in:
konnorrogers
2025-09-10 10:20:36 -04:00
parent 51a11f6785
commit 0b8c3fa3d6

View File

@@ -160,6 +160,15 @@ export default async function (eleventyConfig) {
// Use our own markdown instance
eleventyConfig.setLibrary('md', markdown);
// for files with `unpublished: true`, it will make sure they do not make it into the final build at all, but will be usable in development.
eleventyConfig.addPreprocessor('unpublished', '*', (data, content) => {
if (data.unpublished && process.env.ELEVENTY_RUN_MODE === 'build') {
return false
}
return content
})
// Add anchors to headings
eleventyConfig.addTransform('doc-transforms', function (content) {
let doc = HTMLParse(content, { blockTextElements: { code: true } });