Skip to content

RSS feed rendering issue in Slack #693

@siadat

Description

@siadat

Slack's RSS feed reader does not render https://clojure.org/feed.xml properly. Some HTML tags are truncated. I think it would be a good idea to make sure the feed renders well in more places.

Screenshot 2024-06-03 at 10 56 34

Reproduce

I have subscribed to the feed in https://clojurians.slack.com/archives/C076654T2LD/p1717409306089639 by seding this message in a Slack channel. Need to wait for the next blog post.

/feed add https://clojure.org/feed.xml
/feed add https://aws.amazon.com/blogs/aws/feed/

Solution

Here are some other RSS feeds that render well in Slack:

It might be worth experimenting with JBake templates (which are excluded via .gitignore). At the moment, the full blog body seems to be included in the <description> tag, but the feeds that render ok in Slack keep the description short and wrap the blog content inside a <content:encoded> instead:

The content:encoded element can be used in conjunction with the description element to provide an item's full content along with a shorter summary. Under this approach, the complete text of the item is presented in content:encoded and the summary in description.
https://www.rssboard.org/rss-profile#namespace-elements-content-encoded

Activity

puredanger

puredanger commented on Jun 3, 2024

@puredanger
Member

The Rust example is an Atom feed which is a bit different, but the AWS feed is RSS with entity encoded html and looks pretty much the same to me from a formatting perspective as the Clojure news feed (they also include the full post). How do those compare in the Slack reader?

The FTL template for the current feed looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Clojure News</title>
    <link>${config.site_host}</link>
    <atom:link href="${config.site_host}/${config.feed_file}" rel="self" type="application/rss+xml" />
    <description>Clojure News</description>
    <language>en-gb</language>
    <pubDate>${published_date?string("EEE, d MMM yyyy HH:mm:ss Z")}</pubDate>
    <lastBuildDate>${published_date?string("EEE, d MMM yyyy HH:mm:ss Z")}</lastBuildDate>
    <#list published_posts as post>
    <item>
      <title><#escape x as x?xml>${post.title}</#escape></title>
      <link>${config.site_host}/${post.uri}</link>
      <pubDate>${post.date?string("EEE, d MMM yyyy HH:mm:ss Z")}</pubDate>
      <guid isPermaLink="false">${post.uri}</guid>
      	<description>
	<#escape x as x?xml>	
	${post.body}
	</#escape>
	</description>
    </item>
    </#list>

  </channel> 
</rss>
siadat

siadat commented on Jun 5, 2024

@siadat
Author

Thanks for looking into it! I created the #testing-rss-feed channel in Clojerians and added those feeds there to test how they look like. Feel free to add/remove feeds there using the /feed command.

Here's how they look like:

Screenshot 2024-06-05 at 00 48 52 Screenshot 2024-06-05 at 00 58 35 (1)
siadat

siadat commented on Jun 5, 2024

@siadat
Author

Afaict, Slack displays a substring of <description> and truncates the rest of it, potentially leaving an incomplete HTML tag e.g. <di.

One thing we could do is to substring ${post.body} in <description> ourselves before it is rendered to HTML. Assuming post.body is not rendered already:

        <description>
        <#escape x as x?xml>
-       ${post.body}
+       ${post.body[0..*100]}
        </#escape>
        </description>
+
+       <content:encoded>
+       <#escape x as x?xml>
+       ${post.body}
+       </#escape>
+       </content:encoded>
siadat

siadat commented on Jun 5, 2024

@siadat
Author

But post.body might already be rendered to HTML so it will probably not work 🥲

Also, it doesn't solve the other problem of the extra whitespace between the lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @puredanger@siadat

        Issue actions

          RSS feed rendering issue in Slack · Issue #693 · clojure/clojure-site