Using twig elements in the rss feed


#1

Hello,
I’m using some extra twig items (I’m not sure what to call them) - part of a custom blueprint (?) that allows me to add extra information to my blog posts, like Author Name.

In the template I call these up by using, e.g. {{ page.header.author }}

I’d like to add the name of the author to the link in the rss feed.

I’ve tried inserting {{ page.header.author }} into the feed.rss.twig file in the Grav Feed plugin templates folder:

<title>{{ item.title|e }} by {{ page.header.author }}</title>

but it’s not working. I really don’t have a good enough grasp of the theming / twig / plugin system to solve this problem so would appreciate any suggestions you might have, to point me in the right direction.

Thanks so much, bye
Adam


#2

Notice how the title is pulled from the object item and not page.header. So start with item.author or item.header.author first. (Not tested.)

You should read some primers on Twig and the Grav docs. It’s the only way to learn :slight_smile:


#3

Hello @Perlkonig
thanks so much. I’ll try this out over the weekend.

I’ve gone through a few different primers and the Grav Docs, constantly re-reading them when trying to answer questions like this - before I ask people on forums, but it’s unfortunately, maybe it’s just me, but I generally don’t feel as though their aimed at people like me who have very little coding experience, so there not always helpful for specific questions or when I don’t know the terminology so I don’t know how to ask the question.

It’s always something very simple though, as you’ve shown.
Thanks so much, bye
Adam