Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-12-20 20:32:48

Myusername
Member
Registered: 2019-12-12
Posts: 34

How can I modify the RSS file?

The titles I use in my articles use some exclamation marks to later generate a <span> tag, wrapped around the word I want to highlight.

An example of a title would be: This is my !!title!!
When rendering, it looks like: <h1>This is my <span>title</span></h1>

Everything worked fine so far, but in the site RSS, obviously would be the title with the exclamation points. And I wanted to get help from those who understand the textpattern deeper to help me solve this. Can I modify the RSS file? If so, how can I remove these exclamation marks from RSS titles?

Last edited by Myusername (2019-12-20 20:33:34)

Offline

#2 2019-12-20 22:06:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,962
Website

Re: How can I modify the RSS file?

Can you not use the built-in Textile instead to render spans?

This is my _title_

Then you can use the escape attribute to pass it through Textile and it’ll render the correct markup. This would also work in the RSS feed (for which someone else may be able to assist, I’m just going out, sorry).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2019-12-20 22:19:19

etc
Developer
Registered: 2010-11-11
Posts: 3,530
Website

Re: How can I modify the RSS file?

You could totally replace txp RSS feed with your own as described here, though you’d loose some RSS-specific headers difficult to reconstruct.

Weirdly, you can alter Body and Excerpt in the standard RSS feed via a plugin, but not Title. We will fix it in txp 4.8, thanks for the question and a week of patience.

Offline

#4 2019-12-20 22:28:33

Myusername
Member
Registered: 2019-12-12
Posts: 34

Re: How can I modify the RSS file?

Bloke wrote #320626:

Can you not use the built-in Textile instead to render spans?

In fact, it can be done this way, had not thought of it. However, the RSS feed will still display the symbol required to generate the span tag, and this is the real problem.

Offline

#5 2019-12-20 22:33:30

etc
Developer
Registered: 2010-11-11
Posts: 3,530
Website

Re: How can I modify the RSS file?

A 4.8 plugin, for the record:

register_callback('abc_feed_filter', 'atom_entry');
register_callback('abc_feed_filter', 'rss_entry');

function abc_feed_filter($event, $step) {
    global $thisarticle;

    $thisarticle['title'] = str_replace('!', '', $thisarticle['title']);//or whatever
}

Offline

#6 2019-12-20 22:41:29

Myusername
Member
Registered: 2019-12-12
Posts: 34

Re: How can I modify the RSS file?

etc wrote #320627:

You could totally replace txp RSS feed with your own as described here, though you’d loose some RSS-specific headers difficult to reconstruct.

Weirdly, you can alter Body and Excerpt in the standard RSS feed via a plugin, but not Title. We will fix it in txp 4.8, thanks for the question and a week of patience.

Okay, thank you for your answer.

Offline

Board footer

Powered by FluxBB