mirror of
https://github.com/wallabag/wallabag.git
synced 2025-02-24 14:36:18 +00:00
RFC4287 section 4.2.7.2 specifies that "rel=alternate" is effectively the default for the link element: If the "rel" attribute is not present, the link element MUST be interpreted as if the link relation type is "alternate". So having a plain `<link>` and a `<link rel="alternate">` is kind of weird, *especially* if they point to different resources. So we just remove the plain entry and *replace* it with the rel=alternate, which is really the default here. The sample Atom feeds in RFC4287 (section 1.1) do give an example *only* with `rel="alternate"`: <entry> <title>Atom draft-07 snapshot</title> <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/> <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/> To refer to the actual Wallabag URL, we use the "via", which is defined in the RFC as: 5. The value "via" signifies that the IRI in the value of the href attribute identifies a resource that is the source of the information provided in the containing element. I'm not sure how widely used that tag is, but I feel that the distinction between `rel="alternate"` is weird at best, and buggy (and certainly introducing unpleasantness in my usage) at worse. Before: <link href="{{ entry.url }}"/> <link rel="alternate" type="text/html" href="{{ url('view', {'id': entry.id}) }}"/> <link rel="via" href="{{ entry.url }}"/> That is: <link href="http://example.com/"/> <link rel="alternate" type="text/html" href="http://wallabag.example.com/view/1"/> <link rel="via" href="http://example.com/"/> After: <link rel="alternate" href="{{ entry.url }}"/> <link rel="via" type="text/html" href="{{ url('view', {'id': entry.id}) }}"/> That is: <link rel="alternate" href="http://example.com"/> <link rel="via" type="text/html" href="http://wallabag.example.com/view/1"/> Closes: #7848
53 lines
2.6 KiB
Twig
53 lines
2.6 KiB
Twig
<?xml version="1.0" encoding="utf-8"?>
|
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
{% if type != 'tag' %}
|
|
<title>wallabag — {{ type }} feed</title>
|
|
<subtitle type="html">Atom feed for {{ type }} entries</subtitle>
|
|
<id>wallabag:{{ domainName|removeScheme|removeWww }}:{{ user }}:{{ type }}</id>
|
|
<link rel="alternate" type="text/html" href="{{ url(type) }}"/>
|
|
{% else %}
|
|
<id>wallabag:{{ domainName|removeScheme|removeWww }}:{{ user }}:{{ type }}:{{ tag }}</id>
|
|
<link rel="alternate" type="text/html" href="{{ url('tag_entries', {'slug': tag}) }}"/>
|
|
<title>wallabag — {{ type }} {{ tag }} feed</title>
|
|
<subtitle type="html">Atom feed for entries tagged with {{ tag }}</subtitle>
|
|
{% endif %}
|
|
{% if updated %}
|
|
<updated>{{ updated|date('c') }}</updated> {# Indicates the last time the feed was modified in a significant way. #}
|
|
{% endif %}
|
|
<link rel="self" type="application/atom+xml" href="{{ app.request.uri }}"/>
|
|
{% if entries.hasPreviousPage %}
|
|
<link rel="previous" href="{{ url }}/{{ entries.previousPage }}"/>
|
|
{% endif -%}
|
|
{% if entries.hasNextPage %}
|
|
<link rel="next" href="{{ url }}/{{ entries.nextPage }}"/>
|
|
{% endif -%}
|
|
<link rel="last" href="{{ url }}/{{ entries.nbPages }}"/>
|
|
<generator uri="https://wallabag.org" version="{{ version }}">wallabag</generator>
|
|
<author>
|
|
<name>{{ user }}</name>
|
|
</author>
|
|
<icon>{{ asset('favicon.ico') }}</icon>
|
|
<logo>{{ asset('img/logo-square.svg') }}</logo>
|
|
{% for entry in entries %}
|
|
<entry>
|
|
<title><![CDATA[{{ entry.title|e }}]]></title>
|
|
<link rel="alternate" href="{{ entry.url }}"/>
|
|
<link rel="via" type="text/html"
|
|
href="{{ url('view', {'id': entry.id}) }}"/>
|
|
<id>wallabag:{{ domainName|removeScheme|removeWww }}:{{ user }}:entry:{{ entry.id }}</id>
|
|
<updated>{{ entry.updatedAt|date('c') }}</updated>
|
|
<published>{{ entry.createdAt|date('c') }}</published>
|
|
{% for tag in entry.tags %}
|
|
<category term="{{ tag.slug }}" label="{{ tag.label }}" />
|
|
{% endfor %}
|
|
{% for author in entry.publishedBy %}
|
|
<author>
|
|
<name>{{ author }}</name>
|
|
</author>
|
|
{% endfor %}
|
|
<content type="html" {% if entry.language %}xml:lang="{{ entry.language[:2] }}"{% endif %}>
|
|
<![CDATA[{%- if entry.readingTime > 0 -%}{{ 'entry.list.reading_time_minutes'|trans({'%readingTime%': entry.readingTime}) }}{%- else -%}{{ 'entry.list.reading_time_less_one_minute'|trans|raw }}{%- endif %}{{ entry.content|raw -}}]]>
|
|
</content>
|
|
</entry>
|
|
{% endfor %}
|
|
</feed>
|