I have a standard group of Eleventy posts (markdown files in a folder) which build to the standard site.com/slug/index.html path. I would also like to generate an additional meta file for each of these posts at build time, which is of a different format, and would live at something like site.com/slug/file.ics. So the permalink must change. I only want to have to manage one set of files, the original markdown files contain the meta information required to build the additional file in the front-matter. So I assumed I’d be able to somehow use 2 different templates to manage how the final files were generated.
I’ve tried a handful of things, none work.
Creating a collection via glob, then using Eleventy’s pagination did not work (at least not the way I did it):
/* in the config file */
config.addCollection('articles_meta', (collectionAPI) => {
return collectionAPI.getFilteredByGlob('_content/articles/*.md')
})
/* in an article_meta.md */
---js
pagination: {
data: 'collections.articles_meta',
size: 1,
alias: 'article_meta'
},
permalink: function (data) {
return (
"/articles/" +
`${this.slug(data.title)}` +
"/file.ics"
);
},
}
---
Which gives me an error about not finding collections.articles_meta
. Similarly if I just try to create a data file that returns the collection directly I get the same error. I suspect I’m using the wrong tools for the job. Any suggestions?