jekyll-feed icon indicating copy to clipboard operation
jekyll-feed copied to clipboard

post.id is not unique -- should we use post.url instead?

Open larsks opened this issue 4 years ago • 6 comments

I'm running jekyll-feed (0.15.1) with Jekyll version 3.9.0. The feed generated by jekyll-feed uses the value of post.id to create the unique id for each post. Unfortunately, this value appears to only consider the title slug, meaning that two different posts named like this:

  • _posts/2021-04-02-something.md
  • _posts/2021-04-03-something.md

Will both have post.id set to <baseurl>/something. This causes problems with feed readers, since they use the <id> element to differentiate between posts.

It's not clear to me if this is a Jekyll issue (why isn't post.id unique) or a jekyll-feed issue (just use post.url instead of post.id for the unique id).

larsks avatar Apr 09 '21 20:04 larsks

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

jekyllbot avatar Jun 09 '21 21:06 jekyllbot

@larsks With default configuration, your posts' ids would have been /2021/04/02/something and /2021/04/03/something. Are you using a custom permalink template for your posts?

ashmaroli avatar Aug 07 '21 15:08 ashmaroli

I just noticed this issue too, in a second feed for an events collection. There is no custom permalink set for this collection as far as I can tell, but the URLs for pages look like /events/2021-09-15-meetup.html and the <id> in the feed becomes <id>https://nl-rse.org/events/meetup</id>. For the main feed that has the blog posts, all is as @ashmaroli describes.

bencomp avatar Aug 13 '21 13:08 bencomp

@bencomp Will you be able to set up a minimal repository that showcases the discrepancy reported? Thanks in advance.

ashmaroli avatar Aug 13 '21 16:08 ashmaroli

I think the issue is with Jekyll core, which for non-post collections does not make the date in the filename part of the URL. id is defined as the base URL + slug:

https://github.com/jekyll/jekyll/blob/6855200ebda6c0e33f487da69e4e02ec3d8286b7/lib/jekyll/document.rb#L395-L397

slug is extracted from the filename using a regular expression that matches date parts as well:

https://github.com/jekyll/jekyll/blob/6855200ebda6c0e33f487da69e4e02ec3d8286b7/lib/jekyll/document.rb#L513

Maybe this can be solved by adding permalink templates for collections. Let me try later this week.

bencomp avatar Aug 16 '21 13:08 bencomp

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

jekyllbot avatar Oct 16 '21 13:10 jekyllbot