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

Rss per language

Started by Muut Archive 11 years ago · 4 replies · 312 views
11 years ago

♪ Bonjour!

First of all, I would like to say Thank you:
It is my first site building, I am a beginner, but I'm getting into the deep of the code and though I am able to enjoy it: Grav is really impressive and I would not have even thought that I would be able to get to such point! I am liking it very much!

Also, I have received great support a few days ago through the forum, which I apreciated very much.

Installing currently the feed plugiin, I am experiencing a problem:

My Site is multiligual:
1. fr (French) (default) 2. ja (Japanese) 3. en (English)

So Blog section has a blog.md per language:
1. blog.fr.md (French) 2. blog.ja.md (Japanese) 3. blog.en.md (English)

Problem comes in feed.rss.twig with (here, for example, the japanese version):
---html
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>ホーム</title>
<link>http://localhost/grav/blog.rss</link>
<description>ホームサンプル記述</description>
<language>ja-ja</language>
<atom:link href="http://localhost/grav/blog.rss" rel="self" type="application/rss+xml"/>
<item>
<title>Attentats de Charlie Hebdo: la réaction de M. Onfray</title>
<link>http://localhost/grav/ja/blog/blog-item.item-5</link>
<description>

TXT

problem is in:
`<atom:link href="http://localhost/grav/blog.rss" rel="self" type="application/rss+xml"/>`

`href="http://localhost/grav/blog.rss"` is _not_ the _correct_ adress which is `href="http://localhost/grav/ja/blog.rss"` _because_ `/ja` is _missing_ to be correct

in *twig template*:

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>{{ page.title }}</title>
<link>{{ uri.url(true) }}.{{ uri.extension() }}</link>
<description>{{ collection.params.description }}</description>
<language>{{ collection.params.lang }}</language>
<atom:link href="{{ uri.url(true) }}.{{ uri.extension }}" rel="self" type="application/rss+xml"/>
{% for item in collection %}
{% set banner = item.media.images|first %}
<item>
<title>{{ item.title|e }}</title>
<link>{{ item.url(true) }}</link>
<description>

TWIG


_problem_ is in:
`<atom:link href="{{ uri.url(true) }}.{{  uri.extension }}" rel="self" type="application/rss+xml"/>`

I have looked at *Twig documentation* to _change_ it with *trim filter* or _whatever_, _but_ I could _not_ succeed so far...

*Thanks* in avance for your *support*...

François (V.) alias _Tidivoit_
11 years ago

in the exemple, problem is double as also in html exemple line <link>http://localhost/grav/blog.rss</link> shoul be <link>http://localhost/grav/ja/blog.rss</link> (/ja) is missing to be correct.

In Twip Template, same expression as previous...

11 years ago

thanks for replying:
I just found the answer to my problem by trying ... I did not even thought the answer would be so simple:
I just replaced uri.url(true) by page.url(true)and that was it !!!
Sorry, I can not really believe I have found it and so, please, don't find ridiculous if I come back later ...

11 years ago

That actually sounds like the correct fix :)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1346 9 years ago
Archive · by Muut Archive, 9 years ago
2 933 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2945 9 years ago
Archive · by Muut Archive, 9 years ago
3 1117 9 years ago