Skip to content
Discussion options

You must be logged in to vote

You could create a directory data file which sets the permalink via an eleventyComputed function:

module.exports = {
  eleventyComputed: {
    permalink(data) {
      if (data.permalink) {
        return data.permalink;
      }
      if (data.page.filePathStem.endsWith("/index")) {
        return `${ data.page.filePathStem }.html`;
      }
      return `${ data.page.filePathStem }/`;
    }
  }
};
tree -aI node_modules
.
├── .eleventy.js
├── package-lock.json
├── package.json
├── src/
│   └── pages/
│       ├── 2023-01-09-my-blog-post.md
│       ├── 2023-04-29-custom.md
│       ├── index.md
│       └── pages.11tydata.js
└── www/
    ├── hello/world/index.html
    └── pages/
        ├── ind…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mendhak
Comment options

Answer selected by mendhak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants