Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Using twig elements in the rss feed

Started by Adam Burton 8 years ago · 2 replies · 908 views
8 years ago

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:

TWIG
<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

8 years ago

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 🙂

8 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 47 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago