How can I make posti.id contain more than just the slug?

When validating the atom feed produced by the jekyll-feed plugin, I discovered that I had two items in the feed with the same id. It turns out this is because jekyll-feed uses post.id for the unique id, and I have two posts with identical slugs but different dates.

That is, one post is _posts/2021-04-01-something.md and another is _posts/2021-04-05-something.md, but both have a post.id of /something.

What do I need to set to include the date in post.id?

Thanks!

What happens if the ID is repeated - is that valid for feed readers?

Have you checked the Jekyll feed issues and PRs? Sounds like someone might have had this issue. Or they might explain on their docs.

Otherwise if might be worth adding a big ticket on the repo. To use date in the ID i hyess

Or if you want quick results just rename your one post, even if it is something-b.

Code in the plugin

Have you checked the Jekyll feed issues and PRs? Sounds like someone might have had this issue. Or they might explain on their docs.

This isn’t really an issue with jekyll-feed; I’d run into the same problem if I template my own feeds and try to use post.id. The error I’m trying to correct is that post.id, which should be a unique id for a post, is not. This is a problem with Jekyll itself (or my configuration of Jekyll).

I’m looking for help configuring things so that post.id provides a useful value.

Is it possible that something in the post’s front-matter is causing trouble? Like a permalink setting?

There is nothing in the post front-matter other than title and layout. I have permalink in _config.yml set like this:

permalink: /:year-:month-:day-:title/

Ah, using that permalink I can reproduce the problem you’re seeing with a toy site. Clearly there’s a bug in how page.id is generated when the permalink date isn’t a separate directory. For example, the follow permalink works because of the added slash before :title :

permalink: /:year-:month-:day/:title/

It would be good to get this reported as an issue. At a minimum, Jekyll should produce an error/warning if a particular permalink can’t be used to generate IDs.

For the moment, one work-around might be to use page.url instead of page.id.