Closed wcDogg closed 11 months ago
Okay, so I see this is happening because /blog/index.html/
is paginated. I know I need a permalink like:
permalink: "{%- if pagination.pageNumber == 0 -%}/blog/{%- else -%}/blog/{{- pagination.pageNumber -}}/{%- endif -%}"
Sadly, this and variations of it aren't working - maybe I have the syntax wrong?
Does anything in this help? https://www.11ty.dev/docs/pagination/#remapping-with-permalinks
Not sure what template syntax you're using, but in case you're using some defaults/LiquidJS, this Note is probably semi-relevant:
[!NOTE] that the above example works in Nunjucks but
{{ pagination.pageNumber + 1 }}
is not supported in Liquid. Use{{ pagination.pageNumber | plus: 1 }}
instead.
Figured it out - my permalink above does solve the issue - I had it indented in the YAML :P
I have the same problem with my "blog" section and "quote" section.
blog.json
{
"tags": "blog",
"layout": "single",
"permalink" : "{{ title | slug }}"
}
quote.json
{
"tags": "quote",
"layout": "single",
"permalink" : "{{ title | slug }}"
}
Run npm run build-ghpages
> build-ghpages
> npx @11ty/eleventy
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] Output conflict: multiple input files are writing to `_site/undefined/index.html`. Use distinct `permalink` values to resolve this conflict.
[11ty] 1. ./content/quote/index.md
[11ty] 2. ./content/blog/index.md (via DuplicatePermalinkOutputError)
[11ty]
[11ty] Original error stack trace: (Repeated output has been truncated…)
[11ty] at TemplateMap.checkForDuplicatePermalinks (/home/runner/work/11ty/11ty/node_modules/@11ty/eleventy/src/TemplateMap.js:799:13)
[11ty] at TemplateMap.cache (/home/runner/work/11ty/11ty/node_modules/@11ty/eleventy/src/TemplateMap.js:[4](https://github.com/BayuAngora/11ty/actions/runs/8506589357/job/23297044915#step:7:5)84:10)
[11ty] at async TemplateWriter._createTemplateMap (/home/runner/work/11ty/11ty/node_modules/@11ty/eleventy/src/TemplateWriter.js:330:[5](https://github.com/BayuAngora/11ty/actions/runs/8506589357/job/23297044915#step:7:6))
[11ty] at async TemplateWriter.generateTemplates (/home/runner/work/11ty/11ty/node_modules/@11ty/eleventy/src/TemplateWriter.js:3[6](https://github.com/BayuAngora/11ty/actions/runs/8506589357/job/23297044915#step:7:7)0:5)
[11ty] at async TemplateWriter.write (/home/runner/work/11ty/11ty/node_modules/@11ty/eleventy/src/TemplateWriter.js:40[7](https://github.com/BayuAngora/11ty/actions/runs/8506589357/job/23297044915#step:7:8):23)
[11ty] at async Eleventy.executeBuild (/home/runner/work/11ty/11ty/node_modules/@11ty/eleventy/src/Eleventy.js:1160:13)
[11ty] Copied 5 files / Wrote 0 files in 0.12 seconds (v2.0.0)
Error: Process completed with exit code 1.
I got an error because of that permalink part. Even when my single posts has different title.
Operating system
Windows 11
Eleventy
2.0.1
Describe the bug
Hello - I'm having the strangest issue with permalinks and could use some help.
Repo: https://github.com/wcDogg/eleventy-test
npm run build
- No errorstest-c.md
to either/c_blog/
or/c_docs/
npm run build
- Output conflictI discovered this in a larger project and reproduced it in the repo above:
.eleventy.js
-blog
anddocs
.c_blog
andc_docs
."permalink": "/blog/{{ page.fileSlug }}/"
.index.html
where the default is overridden like this:permalink: /blog/
.This works as expected for the
index.html
,test-a.md
, andtest-b.md
. However, once atest-c.md
is added to either collection, I get this:I'm not sure what's going on or how to investigate further - any help would be much appreciated :)
Reproduction steps
Expected behavior
No response
Reproduction URL
No response
Screenshots
No response