13/4/20185

# Comments

I had to stop myself signing up for the beta of the next version of Ulysses. The main issue I've had with it in the past is its handling of code blocks but version 13 looks to be sorting that, and adding syntax highlighting. The nerd in me got excited and had to be reminded I stopped using it for a reason!

Status
#

I think I might have worked around my RSS feed compatibility issues for title-less posts (seeing as how many feed readers don't handle them elegantly.)

The RSS 2.0 spec states:

"An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed; see examples), and the link and title may be omitted."

But, as we already know, it the item title is empty or not present, many readers will use the description as a fallback which can cause the problem of HTML tags appearing in the text used for the title.

To get round this I have now set up a custom template and trimmed the description to just the first 10 words of the post content with the code below:

<?php $content = get_the_content_feed('rss2'); ?>
<description><?php echo htmlentities(wp_trim_words($content, 10)); ?></description>

This gets the first 10 actual words, excluding tags, and adds an ellipsis.

When a title exists feed readers should use the <content:encoded> element which contains the full, entity-encoded text.

Hopefully, this will make things look just a little better in all cases until more readers adequately support title-less posts.

Updated to include htmlentities()

Status
# Comments

As I’m using a custom RSS template I’ve also thrown in a check for post format so it completely excludes the title element for a status post.

Status
#

I thought I was good to go but Feedbin wouldn't pick up my last two posts. Running the new feed through a validator it was complaining about the single quotes in the description so I've wrapped it within htmlentities() and it's working again.

Status
#

I got sidetracked with the whole RSS thing today. I had made some notes for a post and had planned to flesh it out but that will have to wait. It'll probably do me good to ruminate on it for a while longer.

I've been doing that a bit more lately. I've got a number of items in Feedbin that I've kept unread for a while because I want to consider them more deeply before commenting. Maybe nothing will come of it but I want to at least give it half a chance.

Status