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

Does Feed work with Learn2?

Started by A Y 9 years ago · 5 replies · 703 views
9 years ago

Hello,

I added links to each page (doc).

<a class="button" href="{{ base_url }}.atom"><i class="fa fa-rss-square"></i> Atom 1.0</a>
<a class="button" href="{{ base_url }}.rss"><i class="fa fa-rss-square"></i> RSS</a>

It shows buttons (1).Looks like working (2). But can't add to Feedly (3).

<img src="//cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex036/uploads/getgrav/original/1X/39279103b1aa76a10b6bd7b8f9672b6a21e2a461.jpg" width="378" height="500">

9 years ago

The feed "works", but this is not the way to generate it: the feed needs to be generated form a collection page. Like a blog posts list, for example.

I assume you've based your site on the RTFM skeleton. In this case, there are no collections defined in the pages: it's all based on pages being children of other pages.

If you want your feed to show all the pages you add to the site, create a hidden page (visible: false), define a collection on it, and generate the feed.

For example:

/users/pages/new/default.md

YAML
---
visible: false
content:
    items: 
        '@taxonomy.category': 'docs'
    order:
        by: date
        dir: desc
---

and point the feed links to yoursite.com/new.rss / yoursite.com/new.atom

👍 2
9 years ago

@flavio:
yoursite.com/new.rss

Thank you for your answer. So I made a collection feed but I can't link it. I can't code. These links are not working.

@123:
<a class="button" href="{{ base_url }}.atom"><i class="fa fa-rss-square"></i> Atom 1.0</a>
<a class="button" href="{{ base_url }}.rss"><i class="fa fa-rss-square"></i> RSS</a>

9 years ago

I think you need to change that href location to the new page that defines the collection like @flavio mentioned:

TWIG
<a class="button" href="{{ base_url }}/new.atom"><i class="fa fa-rss-square"></i> Atom 1.0</a>
<a class="button" href="{{ base_url }}/new.rss"><i class="fa fa-rss-square"></i> RSS</a>
9 years ago

Oh, okay. I also changed headers in base.html.twig:

<pre>
<link rel="alternate" type="application/atom+xml" href="{{ base_url_absolute}}/new.atom" title="Atom Feed" />
<link rel="alternate" type="application/rss+xml" href="{{ base_url_absolute}}/new.rss" title="RSS Feed" />
</pre>

It's working perfectly with Feedly. Thank you very much.

9 years ago

This is a super-helpful thread👍 Based on this info I've been able to add an option for RSS support with my Learn2 with Git Sync theme (a customized version of the Learn2 theme). Thanks everyone!

ps - you can get a sneak peek at http://learn.hibbittsdesign.org/
(bottom of sidebar)

👍 1

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 54 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1181 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 73 2 months ago