├── .gitignore ├── src ├── _includes │ └── layouts │ │ └── base.html ├── tags.njk ├── pages.njk └── _data │ └── pages.json ├── www ├── index.html ├── page-1 ├── page-2 ├── page-3 ├── post │ └── index.html └── all │ └── index.html ├── .eleventy.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /src/_includes/layouts/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | {{ content }} 5 |
6 | -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

Home

5 | 6 | Homepage 7 |
8 | -------------------------------------------------------------------------------- /www/page-1: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |

Page 1

6 | 7 | page one 8 | 9 |
10 | -------------------------------------------------------------------------------- /www/page-2: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |

Page 2

6 | 7 | Page 2 8 | 9 |
10 | -------------------------------------------------------------------------------- /www/page-3: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |

Page 3

6 | 7 | Page number 3 8 | 9 |
10 | -------------------------------------------------------------------------------- /www/post/index.html: -------------------------------------------------------------------------------- 1 |

Tag: post

2 | 3 |
    4 |
  1. Page 3
  2. 5 | 6 |
  3. Page 2
  4. 7 | 8 |
  5. Page 1
  6. 9 | 10 |
  7. Home
  8. 11 |
12 | -------------------------------------------------------------------------------- /.eleventy.js: -------------------------------------------------------------------------------- 1 | module.exports = (eleventyConfig) => { 2 | eleventyConfig.addFilter("inspect", require("node:util").inspect); 3 | 4 | return { 5 | dir: { 6 | input: "src", 7 | output: "www", 8 | } 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /www/all/index.html: -------------------------------------------------------------------------------- 1 |

Tag: all

2 | 3 |
    4 |
  1. 5 | 6 |
  2. Page 3
  3. 7 | 8 |
  4. Page 2
  5. 9 | 10 |
  6. Page 1
  7. 11 | 12 |
  8. Home
  9. 13 |
14 | -------------------------------------------------------------------------------- /src/tags.njk: -------------------------------------------------------------------------------- 1 | --- 2 | pagination: 3 | data: collections 4 | size: 1 5 | alias: tag 6 | permalink: "/{{ tag | slug }}/index.html" 7 | --- 8 | 9 |

Tag: {{ tag }}

10 | 11 |
    12 | {% set taglist = collections[ tag ] %} 13 | {% for post in taglist | reverse %} 14 |
  1. {{ post.data.pg.systemProperties.name }}
  2. 15 | {% endfor %} 16 |
17 | -------------------------------------------------------------------------------- /src/pages.njk: -------------------------------------------------------------------------------- 1 | ---js 2 | { 3 | layout: "layouts/base.html", 4 | pagination: { 5 | data: "pages", 6 | alias: "pg", 7 | size: 1, 8 | addAllPagesToCollections: true 9 | }, 10 | tags: ['post'], 11 | eleventyComputed: { 12 | permalink: (data) => { 13 | return data.pg.systemProperties.url; 14 | }, 15 | } 16 | } 17 | --- 18 | 19 |

{{ pg.systemProperties.name }}

20 | 21 | {{ pg.content.body | safe }} 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "11ty-2178", 3 | "description": "Tags only applying to home page when using dynamic permalink (Issue #2178)", 4 | "version": "1.0.0", 5 | "author": "Peter deHaan ", 6 | "bugs": { 7 | "url": "https://github.com/pdehaan/11ty-2178/issues" 8 | }, 9 | "dependencies": {}, 10 | "devDependencies": { 11 | "@11ty/eleventy": "^1.0.0" 12 | }, 13 | "homepage": "https://github.com/pdehaan/11ty-2178#readme", 14 | "keywords": [], 15 | "license": "MPL-2.0", 16 | "main": ".eleventy.js", 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/pdehaan/11ty-2178.git" 20 | }, 21 | "scripts": { 22 | "build": "eleventy", 23 | "test": "echo \"Error: no test specified\" && exit 1" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/_data/pages.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "content": { 4 | "body": "Homepage" 5 | }, 6 | "systemProperties": { 7 | "id": 1069, 8 | "name": "Home", 9 | "createDate": "2021-06-09T12:17:48.38Z", 10 | "updateDate": "2022-01-07T10:23:59.34Z", 11 | "contentTypeAlias": "homePage", 12 | "url": "/", 13 | "urlSegment": "home" 14 | } 15 | }, 16 | { 17 | "content": { 18 | "body": "page one" 19 | }, 20 | "systemProperties": { 21 | "id": 1070, 22 | "name": "Page 1", 23 | "createDate": "2021-06-09T12:17:48.38Z", 24 | "updateDate": "2022-01-07T10:23:59.34Z", 25 | "contentTypeAlias": "contentPage", 26 | "url": "/page-1", 27 | "urlSegment": "page-1" 28 | } 29 | }, 30 | { 31 | "content": { 32 | "body": "Page 2" 33 | }, 34 | "systemProperties": { 35 | "id": 1071, 36 | "name": "Page 2", 37 | "createDate": "2021-06-09T12:17:48.38Z", 38 | "updateDate": "2022-01-07T10:23:59.34Z", 39 | "contentTypeAlias": "contentPage", 40 | "url": "/page-2", 41 | "urlSegment": "page-2" 42 | } 43 | }, 44 | { 45 | "content": { 46 | "body": "Page number 3" 47 | }, 48 | "systemProperties": { 49 | "id": 1072, 50 | "name": "Page 3", 51 | "createDate": "2021-06-09T12:17:48.38Z", 52 | "updateDate": "2022-01-07T10:23:59.34Z", 53 | "contentTypeAlias": "contentPage", 54 | "url": "/page-3", 55 | "urlSegment": "page-3" 56 | } 57 | } 58 | ] 59 | --------------------------------------------------------------------------------