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

doesn't handle tags with spaces or hyphens

Open petere opened this issue 3 years ago • 13 comments

I create a new Jekyll site:

jekyll new test

Edit the _config.yml to include:

feed:
  tags: true

Edit the example post _posts/2022-09-02-welcome-to-jekyll.markdown to include the line:

tag: foo_bar

Then build:

bundle exec jekyll build

I see

...
Jekyll Feed: Generating feed for posts
Jekyll Feed: Generating feed for posts tagged foo_bar

Ok great.

Now instead do

tag: foo-bar

or

tag: foo bar

and no feed is created for the tag (and no message is printed).

I see that the jekyll-feed documentation itself uses examples of tags with hyphens. Also, the Jekyll documentation goes out of its way to explain how to handle tags with spaces in them. So I think both of these ought to be supported. But jekyll-feed apparently silently drops them. What's going on?

petere avatar Sep 02 '22 11:09 petere

Have you tried using the front matter key named as tags instead of the singular? (I'm just checking to see if that works..)

ashmaroli avatar Sep 02 '22 13:09 ashmaroli

Have you tried using the front matter key named as tags instead of the singular?

That doesn't make a difference.

I can see that Jekyll proper parses the tags correctly in any case, because the produced top-level feed.xml contains things like

<category term="jekyll" /><category term="update" /><category term="foo-bar" />

So the tags are recognized, and at least parts of jekyll-feed can see them, just the per-tag feeds somehow disappear in some cases.

petere avatar Sep 02 '22 15:09 petere

Oh, I found this in the code:

https://github.com/jekyll/jekyll-feed/blob/21a7fc9ef03ac954be4d64c8ea34918ee76e58f4/lib/jekyll-feed/generator.rb#L92-L94

I would say:

  • It is probably unnecessary to be so strict. Slashes need to be prohibited, but most other things should be ok.
  • In any case, the examples in the README.md use hyphens, so they are just plain wrong.
  • It might at least be nice to write out a message when a tag gets omitted due to this.

petere avatar Sep 02 '22 18:09 petere

@petere Thanks for digging into the source code. I agree with you that the code directly contradicts the example in the README. You're welcome to submit a pull request to patch the source code if you're interested.

Now that I see it, I am not liking the regex filter without it being mentioned in the README. In other words, if Jekyll Core thinks, foo-bar is a tag, this plugin should just proceed to generate the feed for that tag instead of extra filtering.

ashmaroli avatar Sep 03 '22 06:09 ashmaroli

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/main 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 Nov 03 '22 07:11 jekyllbot

Adding a space to the regexp in the code you found and adding a test to ensure the spaces work fine would fix this issue.

parkr avatar Jan 03 '23 08:01 parkr

Adding a space to the regexp in the code you found and adding a test to ensure the spaces work fine would fix this issue.

Not exactly an option when you are deploying to GitHub Pages, however.

CookiePLMonster avatar Jan 22 '23 18:01 CookiePLMonster

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/main 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 Mar 22 '23 19:03 jekyllbot

Still an issue at least when using a GitHub Pages gem - it might be a good idea to politely remind GitHub to update jekyll-feed to the newest version, but according to changelogs no changes related to this bug should be expected.

CookiePLMonster avatar Mar 22 '23 19:03 CookiePLMonster

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/main 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 May 22 '23 20:05 jekyllbot

My above post is still valid. GitHub Pages plugin is still at 0.15.1.

CookiePLMonster avatar May 22 '23 20:05 CookiePLMonster

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/main 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 Jul 22 '23 21:07 jekyllbot

My above post is still valid. GitHub Pages plugin is still at 0.15.1.

CookiePLMonster avatar Jul 22 '23 21:07 CookiePLMonster