Origami comics

Blog feeds

Site generators create blog feeds via plugins that are often magic and hard to configure.

ssg.config.json
{
  "title": "Alice's Cool Blog",
  "author": "Alice Andrews",
  "url": "https://alicescoolblog.com",
  "plugins": [
    "blog-feed-plugin": {
      "itemsPerPage": 10,
      "includeImages": true,
      "customFields": [
        "readingTime",
        "tags"
      ],
      "dontIncludeDrafts": true,
      "sortBy": "date",
      "sortOrder": "descending",
      "outputFormats": [
        "rss",
        "jsonFeed"
      ],
      "undisableFunctionality": false,
      "plugins-for-feed-plugin": {
        "fancy-date-plugin": {
          "dateFormat": "MMMM D, YYYY",
          "locale": "en-US",
          "isoDates": false
        }
      }
    }
  ],
}

Configuration sounds easy but becomes an awkward form of coding.

Feed formats like JSON Feed are actually comparatively simple! It looks noisy, but it’s just your post data in JSON form.

feed.json
{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Bob's Cool Blog",
  "description": "Bob's thoughts on everything",
  "feed_url": "https://bobscoolblog.com/feed.json",
  "home_page_url": "https://bobscoolblog.com",
  "items": [
    {
      "date_published": "2025-08-13T17:00:00.000Z",
      "id": "https://bobscoolblog.com/posts/2025-08-13.html",
      "title": "Solitude",
      "url": "https://bobscoolblog.com/posts/2025-08-13.html",
      "content_html": "<p><img src=\"https://bobscoolblog.com/images/narcissus.jpg\" alt=\"Narcissus flowers\"></p>\n<p>So why did I come all the way out here away from everyone? My nearest neighbor is a mile away, and there’s no house in sight unless you climb a hill half a mile away. It’s an amazing feeling to have my horizon completely encircled by woods, with no sign of human habitation.</p>\n<p>From my little spot I have a distant view of the railroad where it touches the pond on one side, and the fence skirting the woodland road on the other. But most of the time, it’s as solitary here as being out on the prairies. It feels like I have my own private universe.</p>\n"
    },
    {
      "date_published": "2025-08-10T17:00:00.000Z",
      "id": "https://bobscoolblog.com/posts/2025-08-10.html",
      "title": "Coming home at night",
      "url": "https://bobscoolblog.com/posts/2025-08-10.html",
      "content_html": "<p><img src=\"https://bobscoolblog.com/images/stars.jpg\" alt=\"Nighttime sky showing stars between trees\"></p>\n<p>You might be surprised to learn just how dark it can get in the woods, even on an average night. It’s darker than most people think. Often, I have to look up at the gaps between the trees to find my way, using the faint light from the sky to guide me. When there’s no clear path, I rely on my feet to feel the worn trail or use my hands to recognize familiar trees. For instance, I often pass between two pines that are just eighteen inches apart, even in the pitch-black darkness.</p>\n<p>Sometimes, I come home late on a dark and muggy night, my feet instinctively following the path that my eyes can’t see. I walk in a dream-like state, absent-mindedly navigating my way through the forest. It’s only when I reach my door and have to lift the latch that I snap back to reality. There have been times when I couldn’t recall a single step of my walk, making me wonder if my body could find its way home on its own, just like how a hand automatically finds its way to the mouth.</p>\n"
    }
  ]
}

Write an expression to transform your blog posts to a JSON Feed object using vanilla JavaScript or the Origami dialect.

feed.ori
// Return the set of posts in JSON Feed format
(posts) => {
  version: "https://jsonfeed.org/version/1.1"
  title: "Bob's Cool Blog"
  description: "Bob's thoughts on everything"
  feed_url: "https://bobscoolblog.com/feed.json"
  home_page_url: "https://bobscoolblog.com/feed.json"
  items: Tree.values(Tree.map(posts, (post, slug) => {
    date_published: post.date
    id: url
    title: post.title
    url: `https://bobscoolblog.com/posts/${ slug }`
    content_html: post._body
  }))
}

The same object can be turned into an RSS feed. You can define your blog feeds without any plugins!

site.ori
{
  // Render the posts in JSON Feed and RSS formats
  feed.json = Tree.json(feed.ori(postData.ori))
  feed.xml = Origami.rss(feed.ori(postData.ori))

  // The posts area contains a page for each individual post
  posts/ = Tree.map(postData.ori, singlePostPage.ori)
}
https://alicescoolblog.com/feed.xml
<?xml version="1.0" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Bob&apos;s Cool Blog</title>
    <description>Bob&apos;s thoughts on everything</description>
    <link>https://bobscoolblog.com</link>
    <atom:link href="https://bobscoolblog.com/feed.xml" rel="self" type="application/rss+xml"/>
    <item>
      <pubDate>Wed, 13 Aug 2025 17:00:00 GMT</pubDate>
      <title>Solitude</title>
      <link>https://bobscoolblog.com/posts/2025-08-13.html</link>
      <guid>https://bobscoolblog.com/posts/2025-08-13.html</guid>
      <content:encoded><![CDATA[<p><img src="https://bobscoolblog.com/images/narcissus.jpg" alt="Narcissus flowers"></p>
<p>So why did I come all the way out here away from everyone? My nearest neighbor is a mile away, and there’s no house in sight unless you climb a hill half a mile away. It’s an amazing feeling to have my horizon completely encircled by woods, with no sign of human habitation.</p>
<p>From my little spot I have a distant view of the railroad where it touches the pond on one side, and the fence skirting the woodland road on the other. But most of the time, it’s as solitary here as being out on the prairies. It feels like I have my own private universe.</p>
]]></content:encoded>
    </item>
    <item>
      <pubDate>Sun, 10 Aug 2025 17:00:00 GMT</pubDate>
      <title>Coming home at night</title>
      <link>https://bobscoolblog.com/posts/2025-08-10.html</link>
      <guid>https://bobscoolblog.com/posts/2025-08-10.html</guid>
      <content:encoded><![CDATA[<p><img src="https://bobscoolblog.com/images/stars.jpg" alt="Nighttime sky showing stars between trees"></p>
<p>You might be surprised to learn just how dark it can get in the woods, even on an average night. It’s darker than most people think. Often, I have to look up at the gaps between the trees to find my way, using the faint light from the sky to guide me. When there’s no clear path, I rely on my feet to feel the worn trail or use my hands to recognize familiar trees. For instance, I often pass between two pines that are just eighteen inches apart, even in the pitch-black darkness.</p>
<p>Sometimes, I come home late on a dark and muggy night, my feet instinctively following the path that my eyes can’t see. I walk in a dream-like state, absent-mindedly navigating my way through the forest. It’s only when I reach my door and have to lift the latch that I snap back to reality. There have been times when I couldn’t recall a single step of my walk, making me wonder if my body could find its way home on its own, just like how a hand automatically finds its way to the mouth.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>

You’ll learn reusable concepts, and have total control!

Read more: The Origami.rss() function

  Comic index