Scroll to top

19/12/2022


2022/12/19#p1

0 comments: click to leave a comment

Following on from yesterday, /reader now supports RSS enclosures. If an item includes one it is displayed beneath the content:

RSS enclosure

Now, I'm working on adding support to the live RSS feed so there may be some tests and breakage.

No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



2022/12/19#p3

0 comments: click to leave a comment

Enclosures look to be working!

It was easy adding support to /reader, just a case of checking for the enclosure tag in an item, but having enclosures in my own posts was a little more challenging.

I've opted to add them using a new content filter and then process that in different ways based on where it is.

On the blog the filter is simply replaced with an audio tag. No problem there. For the RSS feed, however, I jump through a few hoops:

  • remove the filter from the post content so it's not duplicated
  • convert the URL of the enclosure file to a physical path
  • use filesize() and mime_content_type() to get the required info from the file
  • construct an enclosure tag with url, length, and type parameters
  • add that to the feed item

It's a little convoluted but seems to work okay and allows me to keep the same posting workflow, just with a different content filter.

No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



Close