jekyll / jekyll-feed

:memo: A Jekyll plugin to generate an Atom (RSS-like) feed of your Jekyll posts
MIT License
847 stars 206 forks source link

exclude posts from feed #376

Closed arielelkin closed 1 year ago

arielelkin commented 2 years ago

Hello folks

I'd like to generate feeds for collection items only, not posts.

In my _config.yml file I have:

feed:
  collections:
    authors:
      path: "/feed.atom"

This generates the desired _site/feed.atom, but it also generates a feed.xml of the posts. How can I suppress generation of feed.xml?

ashmaroli commented 2 years ago

@arielelkin As of now, there's no option to disable generation of the posts' feed.xml. The workaround would be overwriting the default feed with your feed by using the path: "feed.xml" setting instead of the feed.atom as in your suggestion. But yes, that is a brittle solution.

arielelkin commented 2 years ago

Thanks for the response @ashmaroli

I can't get your suggestion to work, i'm afraid... I've tried following it thus:

feed:
  collections:
    authors:
      path: "/feed.xml"

But the generated feed.xml file still contains posts instead of items from the authors collection.

jekyllbot commented 2 years ago

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.

arielelkin commented 2 years ago

any updates on this? @parkr

parkr commented 2 years ago

No updates! Want to submit a PR?

I think the right approach here is that we release a major version update that respects the config exactly rather than auto-injecting the posts collection even if other collections are configured.

arielelkin commented 2 years ago

I would like to submit a PR but I lack the required background in Ruby..

jekyllbot commented 1 year ago

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.

parkr commented 1 year ago

@arielelkin It looks like the code will actually use a configured posts path, so put it elsewhere?

feed:
  collections:
    authors:
      path: "/feed.xml"
    posts:
      path: "/feed/posts.xml"

Try that and maybe /feed.xml will contain the authors feed?

arielelkin commented 1 year ago

@parkr Thank you for your suggestion!

With your code, /feed.xml now contains the authors feed, but a feed of all posts is still produced in /feed/posts.xml.

It makes things slightly tidier, but it doesn't address the original issue. It'd be nice to have the option to entirely suppress generation of the posts feed.

ashmaroli commented 1 year ago

but a feed of all posts is still produced in /feed/posts.xml.

@arielelkin Perhaps not an intuitive solution, but you have control over the "file" marked as feed for posts. It can be any existing file in your source dir. If you have, say a 404.html file at the root of your site to render custom Error 404! Not Found! page, point to that.

feed:
  collections:
    authors:
      path: "/feed.xml"
    posts:
      path: "404.html"

The feed generator will only generate a feed file if the given file doesn't exist at source directory.

arielelkin commented 1 year ago

@ashmaroli thanks for the workaround, it works fine!

jekyllbot commented 1 year ago

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.