engelsystem/resources/views/api/atom.twig

29 lines
1.1 KiB
Twig

{% set dateFormat = 'Y-m-d\\TH:i:sP' %}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>{{ url('/') }}</id>
<title>{{ config('app_name') }}</title>
<updated>{% if not news.isEmpty() %}{{ news[0].updated_at.format(dateFormat) }}{% else %}0000-00-00T00:00:00+00:00{% endif %}</updated>
<link rel="self" type="application/atom+xml" href="{{ url('/atom', {'key': request.get('key') }) }}"/>
{% for news in news %}
<entry>
<title>{% if news.is_meeting %}{{ __('news.is_meeting') }} {% endif %}{{ news.title }}</title>
<id>urn:uuid:{{ uuidBy(news.id, '113115') }}</id>
<link href="{{ url('/news/' ~ news.id) }}"/>
<updated>{{ news.updated_at.format(dateFormat) }}</updated>
<published>{{ news.created_at.format(dateFormat) }}</published>
<author>
<name>{{ news.user.displayName }}</name>
</author>
<content type="html">
{{ news.text }}
</content>
</entry>
{% endfor %}
</feed>