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

Duplicate permalink outputs nothing #322

Closed
danurbanowicz opened this issue Nov 30, 2018 · 6 comments
Closed

Duplicate permalink outputs nothing #322

danurbanowicz opened this issue Nov 30, 2018 · 6 comments
Assignees
Labels
Milestone

Comments

@danurbanowicz
Copy link

danurbanowicz commented Nov 30, 2018

Using v6.0.0 I'm setting a default permalink structure for my posts in a directory JSON data file like so:-

{
  "permalink": "agenda/{{ page.date | date: '%d-%m-%Y' }}-{{ title | slug }}/index.html"
}

Which, as expected outputs a post with the following permalink:-

/12-01-2019-my-cool-post

However, when I create a new post with an identical title and date to an existing post, it outputs nothing, and does not output an error.

Expected behaviour would be that Eleventy adds a numeric suffix to the duplicate permalink e.g.

/12-01-2019-my-cool-post-1

or that it throws an error.

Could someone try creating a duplicate permalink (using frontmatter data or otherwise) to see what happens?

@jevets
Copy link

jevets commented Nov 30, 2018

Yup, I'm getting the same behavior.

I only end up with one file in the build folder, and its contents aren't compiled correctly. Seems to be overwritten by the second post but it's jumbled up.

https://github.com/jevets/eleventy-issue-322

(For now, I'd probably workaround using a slug frontmatter data, then update the permalink string to use it or default to the title | slug filter.)

@edwardhorsford
Copy link
Contributor

I don't know if I'd expect automatic adding of a numeric suffix (which post goes in which order? does eleventy guarantee template render order?), but it would seem sensible to warn when trying to render a page that has already been rendered.

@zachleat zachleat added the bug label Dec 2, 2018
@zachleat
Copy link
Member

zachleat commented Dec 2, 2018

A ha! Yes, I agree that a warning (maybe even an error?) is in order here.

@zachleat
Copy link
Member

zachleat commented Jun 8, 2019

We’re going to go with a warning for now and I filed #562 to talk about changing it to an error in the next major version.

@zachleat
Copy link
Member

zachleat commented Jun 8, 2019

Hmm, I think I’m changing my mind on this error behavior. Right now you could get very unpredictable results when you use two permalinks that point to the same output file. I’m leaning towards using a full error for this and failing the build.

@zachleat
Copy link
Member

zachleat commented Jun 8, 2019

Follow along at #562.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants