I am trying to setup a linkroll sorta similar to what Daring Fireball and many others do.
At a high level it’s a reverse chronological page sorted by date with a list of links compromised of individual posts where the title links to the 3rd party URL and the body has my brief commentary. This is not very imaginative but if helpful to see it I have a working version here:
https://danielraffel.me/links/
How it works: I wrote a GCP Cloud Function that listens to a webhook from the bookmarking service omnivore.app and when it’s triggered it programmatically posts links which feature a custom omnivore tag (and annotation) to my blog with the tag ‘links’ right after I save them on Omnivore. It makes sharing interesting stuff I find a little easier than always having to write a traditional blog post. But, obviously there will be a lot more of these generated. While I do want a custom feed for them I also want them to avoid them appearing on my main blog.
Here’s where I am at: I have the content from Omnivore auto-posting to Ghost and the links getting reformated how I want on a custom links.hbs. But, I can’t figure out how to create a custom RSS feed for the linkroll hosted on links.hbs. And, I can’t figure out what I am doing wrong.
I have tried a few things to make this work and could use some help configuring my routes.yaml and / or revisiting how I organize the site. I am quite flexible to adjust things if there’s a way to get this working.
At a high level my intentions are for my blog posts to appear on the top level domain without showing any of the posts that are tagged as links. And, I want to host a custom page that renders posts that are just the links. And I want each of those to have custom RSS feeds.
I’m trying to figure out how to configure my Routes.yaml and RSS.hbs so that Ghost can do the following:
-
The main domain, https://danielraffel.me/, should display all blog posts, excluding those tagged as
links
. Additionally, I want danielraffel.me/rss to provide an RSS feed which omits posts tagged withlinks
. -
The URL danielraffel.me/links is currently dedicated to a custom links.hbs that renders links I am posting programmatically. This page already exists and aggregates all posts tagged
links
, sorted by date in reverse chronological order. This page should host a custom RSS feed available at danielraffel.me/links.rss featuring only the posts tagged withlinks
. I cannot figure out how to set up an RSS feed to do this.
I’ve tried a variety of configurations but just can’t figure out how to support #2 while also supporting #1. For example I seem to see all posts in the RSS feed when I add danielraffel.me/links/rss to my feed reader when I would expect to only see the ones tagged links. I’ve played around customizing the links/rss file to remove limit all and to include filter=“tag:links” in #get but nothing I’ve tried has worked and I’m sorta outta ideas.
Any counsel for how I might explore getting this working would be greatly appreciated. Thanks!
route.yaml
routes:
/rss/:
template: rss
content_type: text/xml
/links/rss/:
template: links/rss
content_type: text/xml
collections:
/:
permalink: /{year}/{month}/{day}/{slug}/
template: index
filter: tag:-links
/links/:
permalink: /links/{year}/{month}/{day}/{slug}/
template: links
filter: primary_tag:links
data: tag.links
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
rss.hbs
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title><![CDATA[ {{@site.title}} ]]></title>
<description><![CDATA[ {{@site.description}} ]]></description>
<link>{{@site.url}}</link>
<image>
<url>{{@site.url}}/favicon.png</url>
<title>{{@site.title}}</title>
<link>{{@site.url}}</link>
</image>
<lastBuildDate>{{date format="ddd, DD MMM YYYY HH:mm:ss ZZ"}}</lastBuildDate>
<atom:link href="{{@site.url}}" rel="self" type="application/rss+xml"/>
<ttl>60</ttl>
{{#get "posts" limit="all" include="authors,tags"}}
{{#foreach posts}}
<item>
<title><![CDATA[ {{title}} ]]></title>
<description><![CDATA[ {{excerpt}} ]]></description>
<link>{{url absolute="true"}}</link>
<guid isPermaLink="false">{{id}}</guid>
<category><![CDATA[ {{primary_tag.name}} ]]></category>
<dc:creator><![CDATA[ {{primary_author.name}} ]]></dc:creator>
<pubDate>{{date format="ddd, DD MMM YYYY HH:mm:ss ZZ"}}</pubDate>
<media:content url="{{feature_image}}" medium="image"/>
<content:encoded><![CDATA[ {{content}} ]]></content:encoded>
</item>
{{/foreach}}
{{/get}}
</channel>
</rss>