├── .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 | - Page 3
5 |
6 | - Page 2
7 |
8 | - Page 1
9 |
10 | - Home
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 |
5 |
6 | - Page 3
7 |
8 | - Page 2
9 |
10 | - Page 1
11 |
12 | - Home
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 | - {{ post.data.pg.systemProperties.name }}
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 |
--------------------------------------------------------------------------------