bridgetownrb / bridgetown-feed

A Bridgetown plugin to generate an Atom feed of your Bridgetown posts
MIT License
20 stars 7 forks source link

Doesn't override post id via frontmatter #15

Closed joshuap closed 8 months ago

joshuap commented 8 months ago

The readme says you can override the entry id (among other options) in a post's frontmatter:

The plugin will use the following post metadata, automatically generated by Bridgetown, which you can override via a post's YAML front matter:

  • date
  • title
  • excerpt
  • id
  • category
  • tags

https://github.com/bridgetownrb/bridgetown-feed/tree/master?tab=readme-ov-file#optional-front-matter

After installing the bridgetown-feed plugin, I updated Bridgetown's sample blog post to include an id in the frontmatter:

---
layout: post
title:  "Your First Post on Bridgetown"
date:   2024-02-17 13:48:19 -0800
categories: updates
id: "https://www.honeybadger.io/blog/ahoy-rails-analytics/"
---
Post content

The feed doesn't use the frontmatter override, however—it appears to be hardcoded to use post.id, which is actually post.model.origin.id:

https://github.com/bridgetownrb/bridgetown/blob/0e10adf601bf47c621505aa02d1247951a99e905/bridgetown-core/lib/bridgetown-core/resource/base.rb#L185

Here's the entry XML:

<entry>
  <title type="html">Your First Post on Bridgetown</title>
  <link href="http://localhost:4000/blog/welcome-to-bridgetown" rel="alternate" type="text/html" title="Your First Post on Bridgetown"/>
  <published>2024-02-17T13:48:19-08:00</published>
  <updated>2024-02-17T13:48:19-08:00</updated>
  <id>repo://posts.collection/_posts/2024-02-17-welcome-to-bridgetown.md</id>
  <content type="html" xml:base="http://localhost:4000/blog/welcome-to-bridgetown">
    Post content
  </content>
  <author>
    <name/>
  </author>
</entry>
jaredcwhite commented 8 months ago

Fixed in v3.1.2.