Go to main content

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: 165

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: 11,456
Website GitHub

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: 5,211
Website GitHub

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: 165

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: 5,211
Website GitHub

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: 165

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

#7 2021-08-11 00:57:00

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

Re: How can I modify the RSS file?

I used the plugin above to make a modification to the body of the article, but this stopped working for some time now.

Looking at the rss feed code and comparing older versions with version 4.9.0-dev, I noticed that now (I don’t know since when) the variable $thisarticle[‘body’] is no longer used. At least not here. I don’t know if this is the cause, but I believe it is.

Anyway, how can I make this work now?

Offline

#8 2021-08-11 14:07:45

etc
Developer
Registered: 2010-11-11
Posts: 5,211
Website GitHub

Re: How can I modify the RSS file?

Oops, we have done it (again) when fixing this issue, but I don’t remember why. Is replacing $Body_html/$Excerpt_html with $thisarticle['body/excerpt'] in core working for you?

Offline

#9 2021-08-11 18:05:48

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

Re: How can I modify the RSS file?

You say directly in the rss.php file? Yes, probably, although I haven’t tested it. It’s a little bad as I will have to remember to change the file with every update.

Offline

#10 2021-08-12 08:57:42

etc
Developer
Registered: 2010-11-11
Posts: 5,211
Website GitHub

Re: How can I modify the RSS file?

Myusername wrote #331306:

You say directly in the rss.php file? Yes, probably, although I haven’t tested it. It’s a little bad as I will have to remember to change the file with every update.

I mean just help us to test, we will restore it in 4.8.8 if it works fine. Thanks!

Offline

#11 2021-08-12 21:01:10

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

Re: How can I modify the RSS file?

I made the changes and then tested it like you said here. Everything is ok, no problem with titles apparently.

Last edited by Myusername (2021-08-12 21:02:38)

Offline

#12 2021-08-15 14:00:30

etc
Developer
Registered: 2010-11-11
Posts: 5,211
Website GitHub

Re: How can I modify the RSS file?

Changes made in core, thanks for testing.

Offline

Board footer

Powered by FluxBB