-
Notifications
You must be signed in to change notification settings - Fork 203
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
Generate a feed for each category. #176
Conversation
f574d50
to
1e7e32a
Compare
1e7e32a
to
af6272f
Compare
@mortenson this great. Thanks for opening the PR. I'd be curious your thoughts on #70 (comment) and the subsequent discussion. It sounds like you're moving from a platform that offers category feeds and are seeking to maintain feature parity. If we add a feature, we have to support it in perpetuity, regardless of how often it's used. Do you have any stats on how often category feeds are subscribed to? |
I don't have much quantitative data - but can speak to why I would like to see this feature. As I mentioned earlier, I just started using Jekyll this week, and got a minimal blog up at http://mortenson.coffee/blog. This is my personal site, and I plan on writing posts about a variety of topics. The problem I'm running into is that I'd like to add my blog to Planet Drupal, which is an aggregate of a ton of Drupal community blogs, but they specifically require that your RSS feed only contains Drupal-related content:
My blog at this point would not qualify for aggregation here, as I plan to mix personal posts with Drupal-related posts. There are 615 sites in this aggregate, and each site provides a specific RSS feed just for Drupal. It helps that most of those blogs are also built with Drupal, which provides this functionality out of the box and is highly utilized. A similar CMS, Wordpress, lets you filter arbitrarily by multiple criteria (author, tag, date, etc.), which obviously isn't a fit for static sites. In the short-term, I could just create a hard-coded RSS page in Jekyll that only shows Drupal posts, but if I want to add my blog to a security aggregate I would have to do the same task. The same goes for displaying just my personal posts on another site - without this functionality I'll end up maintaining my own RSS feeds, which means I wouldn't be using jekyll-feed at all. |
I often use category feeds are subscribed to Fedora planet which which is an aggregate feed of Fedora communities. I am using blogspot before, now after move to jekyll.. I need this features on my theme which using jekyll-feed plugin. |
Same on Planet Mozilla. |
Same for user feeds on specific StackExchange chats. Although my community is very open and wouldn't bother some off-topic posts, I would like to separate this too. Not that I have time to write many posts, but this is another issue. |
I would benefit from this substantially as my site currently has several separate sections with significantly disparate content — few, if any of my subscribers use both. Migrating to Jekyll has meant that new posts are substantially easier, but a unified feed for everything on the site doesn't meet my needs. This particular feature seems to me to be a fairly minimal change and one worth supporting. If the concern is that automatic generation of new feeds is unwanted — as that changes the default output — a simple solution would be to enable specific categories in your feed:
multifeed:
- xyzzy
- plugh in the user's I was actually about to start working on a PR that functioned that way before I found this, but thought I ought to mention that possibility before duplicating efforts. Thoughts? |
I think I was the one that originally 👎'd this feature. I still stand by my comments in #70 (comment), but it's clear that it's something many users want to implement (even if what little data we have suggests it's not actually used). If we can implement this in a way that minimizes complexity and the burden on the user, I'd be 👍 to supporting this going forward (and will leave some comments on the PR about the code itself). |
@@ -33,6 +33,11 @@ | |||
|
|||
{% assign posts = site.posts | where_exp: "post", "post.draft != true" %} | |||
{% for post in posts limit: 10 %} | |||
{% if page.category %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to filter the category above, otherwise the limit will be off. I believe the following should work:
site.categories[page.category] | where_exp: "post", "post.draft != true"
@site.pages << content_for_file(feed_path, feed_source_path) | ||
end | ||
@site.categories.each do |category| | ||
path = "/feed/" + category.first + ".xml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is category.first
?
file = PageWithoutAFile.new(@site, __dir__, "", file_path) | ||
file.content = File.read(file_source_path).gsub(MINIFY_REGEX, "") | ||
file.data["layout"] = nil | ||
file.data["sitemap"] = false | ||
file.data["xsl"] = file_exists?("feed.xslt.xml") | ||
file.data["category"] = category |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be cleaner to allow the template to accept an arbitrary array of documents? That way, we can pass it all post, a category, a tag, or even another collection.
@benbalter Thanks for pushing this PR forward. This is highly appreciated. |
@mortenson Any chance you can fix the issues pointed out by @benbalter? I'm still keen to see this merged. Or has a similar feature been added to Jekyll in the meantime by a different PR? |
@halirutan I believe #228 is the PR to watch now - @benbalter is working on it. |
#228 Has been merged, closing. |
Like others in #70, I want to have a feed per-category so that readers can subscribe only to topics that interest them. When testing this PR, you should be able to visit
/feed/category.xml
, where "category" is your category name.I've only implemented categories here, as it seems like there would be loads of tags and users may expect complicated syntax like:
/feed/tag1/tag2/combined.xml
. Categories are how you categorize your content, so it makes sense that they would represent individual feeds.I just started using Jekyll, and have never written Ruby/Liquid before, so forgive me if anything is amiss here.