How do I modify article headline/title with filter?

Hello.

I would like to add **** or >>>> at the beginning of an article headline/title if it contains some keyword. It would make spotting certain articles much easier for me among the many.

ttrss filters are great for that. But I couldn’t figure out the action part: how to change the title/headline of an article, in this case add **** or >>>> at the beginning.

Do I need some plugin for that or have I overlooked an option?

I would be very glad if you could help out a beginner here.

Thank you very much.

I’m afraid there’s no such feature. But how would this be more useful than tags?

You can absolutely do this with a plugin, but you’d have to write it yourself. Still, there are hooks where you could have filters trigger the plugin so you would be able to easily modify which articles stand out.

But as Mamil said, using tags is really the way to go. Even marking articles as starred would probably be better.

I agree, tags would be best and it’s what I looked at first.
Unfortunately, the rss client reeder that I’ve been using for a long time now does not support/show ttrss tags. That’s the only reason I’ve started thinking about this less than elegant workaround.
Edit: I’ve created a super simple mini plugin basically using the example filter plugin provided and changing some minor stuff.

So here’s the code if anyone is interested:

<?php
class Headline_Prefix extends Plugin {
    private $host;

    function about() {
        return array(1.0,
            "Add article headline prefix",
            "fox");
    }

    function init($host) {
        $this->host = $host;

        $host->add_hook($host::HOOK_ARTICLE_FILTER_ACTION, $this);

        $host->add_filter_action($this, "add prefix ****", "add prefix ****");
        $host->add_filter_action($this, "add prefix >>>>", "add prefix >>>>");
    }

    function hook_article_filter_action($article, $action) {
        if ($action == "add prefix ****") {
	        $article["title"] = "[****] " . $article["title"];
        }
        
        if ($action == "add prefix >>>>") {
	        $article["title"] = ">>>> " . $article["title"];
        }

        return $article;
    }

    function api_version() {
        return 2;
    }
}
?>

Maybe one day I’ll even be able to use the very keyword in the filter rule as a prefix.
But for now I’m glad it works at all.