You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to set a global permalink format (mainly to NOT create files as path-to/index.html because I'm trying to use 11ty to create html emails and need the file names.)
I'm trying _data/permalink.js
module.exports='{{slug}}.html';
to set the global data field for this but it doesn't translate the usual {{slug}}.html and I don't know of any args being passed to JS data files.
This results in
Output conflict: multiple input files are writing to `dist/{{slug}}.html`. Use distinct `permalink` values to resolve this conflict.
1. ./src/emails/febs.md
2. ./src/emails/febs copy.md
`DuplicatePermalinkOutputError` was thrown:
(Repeated output has been truncated…)
at TemplateMap.checkForDuplicatePermalinks (/Users/zpykosz/Sites/11ty-emails/node_modules/@11ty/eleventy/src/TemplateMap.js:533:13)
at TemplateMap.cache (/Users/zpykosz/Sites/11ty-emails/node_modules/@11ty/eleventy/src/TemplateMap.js:306:10)
at async TemplateWriter._createTemplateMap (/Users/zpykosz/Sites/11ty-emails/node_modules/@11ty/eleventy/src/TemplateWriter.js:133:5)
at async TemplateWriter.write (/Users/zpykosz/Sites/11ty-emails/node_modules/@11ty/eleventy/src/TemplateWriter.js:168:5)
at async Eleventy.write (/Users/zpykosz/Sites/11ty-emails/node_modules/@11ty/eleventy/src/Eleventy.js:659:13)
Wrote 0 files in 0.11 seconds (v0.10.0)
Setting emails/emails.json doesn't work either.
{
"permalink": "{{slug}}.html"
}
Same error. It doesn't translate the slug into real file name.
As far as I can tell there's no config setting for globally setting the permalinks either.
What's the ideal config for doing this?
The text was updated successfully, but these errors were encountered:
Global data files don't get access to page data like that. Also JS data files don't support templating permalinks in a string (I think) since permalinks use whatever templating engine the file uses (JS doesn't have one: you have to use functions for dynamic permalinks).
The new Computed Data feature allows you to do what you're looking for. You can create a global _data/eleventyComputed.js that will have access to template data. You can then use a JS function to return dynamic permalink:
Trying to set a global permalink format (mainly to NOT create files as
path-to/index.html
because I'm trying to use 11ty to create html emails and need the file names.)I'm trying
_data/permalink.js
to set the global data field for this but it doesn't translate the usual
{{slug}}.html
and I don't know of any args being passed to JS data files.This results in
Setting
emails/emails.json
doesn't work either.Same error. It doesn't translate the slug into real file name.
As far as I can tell there's no config setting for globally setting the permalinks either.
What's the ideal config for doing this?
The text was updated successfully, but these errors were encountered: