Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page path collisions #366

Closed
paulcmal opened this issue Aug 9, 2018 · 6 comments
Closed

Page path collisions #366

paulcmal opened this issue Aug 9, 2018 · 6 comments
Labels
done in pr Already done in a PR

Comments

@paulcmal
Copy link
Contributor

paulcmal commented Aug 9, 2018

While implementing section assets, i encountered an edge case where two pages try to render to the same path and one overwrites the other silently. I believe there should be some kind of runtime warning in such situations even though that should not happen often.

Otherwise, we should add in the content docs explanations about when collisions may happen (i'm guessing it's because of slugification?) and how to avoid them. Maybe it's already somewhere in the docs? I just didn't see ^^

Content tree:

└── content/
    ├── _index.md
    └── blog/
        ├── _index.md
        ├── capitalism.jpg
        ├── _index/
             ├── index.md
             └── capitalism.jpg ← (not the same one as in blog/, i was trying to force collisions)
        ├── index/
             ├── index.md

Here _index/index.md gets rendered to /blog/index and index does not get rendered (or at least not copied to public). Renaming either _index/ or index/ enables both to get rendered properly.

Debug info:

Parsing page from file "/home/user/Sites/Gutenberg/content/blog/_index/index.md"
Parsing page from file "/home/user/Sites/Gutenberg/content/blog/index/index.md"
Now pages:
[Ok(Page { file: FileInfo { path: "/home/user/Sites/Gutenberg/content/blog/_index/index.md", name: "index", relative: "blog/_index/index.md", parent: "/home/user/Sites/Gutenberg/content/blog", grand_parent: None, components: ["blog"] }, meta: PageFrontMatter { title: Some("Bloggity blog"), description: None, date: Some("2018-03-01"), draft: false, slug: None, path: None, taxonomies: {}, order: None, weight: None, aliases: [], template: None, in_search_index: true, extra: {} }, raw_content: "\n![](capitalism.jpg)\n", assets: ["/home/user/Sites/Gutenberg/content/blog/_index/capitalism.jpg"], content: "", slug: "index", path: "blog/index/", components: ["blog", "index"], permalink: "http://127.0.0.1:1111/blog/index/", summary: None, earlier: None, later: None, lighter: None, heavier: None, toc: [] }), Ok(Page { file: FileInfo { path: "/home/user/Sites/Gutenberg/content/blog/index/index.md", name: "index", relative: "blog/index/index.md", parent: "/home/user/Sites/Gutenberg/content/blog", grand_parent: None, components: ["blog"] }, meta: PageFrontMatter { title: Some("fucking page"), description: None, date: Some("2018-03-01"), draft: false, slug: None, path: None, taxonomies: {}, order: None, weight: None, aliases: [], template: None, in_search_index: true, extra: {} }, raw_content: "", assets: [], content: "", slug: "index", path: "blog/index/", components: ["blog", "index"], permalink: "http://127.0.0.1:1111/blog/index/", summary: None, earlier: None, later: None, lighter: None, heavier: None, toc: [] })
@paulcmal paulcmal changed the title Show warning in case of page collision Page path collisions Aug 9, 2018
@Keats
Copy link
Collaborator

Keats commented Aug 15, 2018

I agree there should be some mention in the docs, and it should maybe even be an error if two pages get rendered at the same end path

@Keats
Copy link
Collaborator

Keats commented Mar 26, 2019

That's going to be checked with the upcoming zola check subcommand

@phil-opp
Copy link
Contributor

Any updates on this? The zola check command exists now, but I'm not sure if this is included.

It would be also very useful to have this error also on zola build since I can't use zola check right now because of #805.

@Keats
Copy link
Collaborator

Keats commented Nov 26, 2019

I did forget about this. It should be easy to implement if anyone is looking an easy issue and as mentioned should happen in zola build as well as zola check as it is likely an issue in a site that needs to be fixed.

@Keats
Copy link
Collaborator

Keats commented Dec 1, 2019

It's in next with some pretty ugly code but it does the job.

@phil-opp
Copy link
Contributor

phil-opp commented Dec 2, 2019

Great, thanks!

@Keats Keats added done in pr Already done in a PR and removed enhancement good first issue labels Feb 11, 2020
@Keats Keats closed this as completed in 5532f62 Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done in pr Already done in a PR
Projects
None yet
Development

No branches or pull requests

3 participants