news-reader-php/templates/entry/_single.html.twig
Daniel Siepmann 8efad3e1fd
Add import of feed entries
Basic import of entries from feeds.
Also make imported feeds accessible in frontend.
2020-05-29 00:44:32 +02:00

32 lines
1.5 KiB
Twig

<article>
<h1><a href="{{ path('entry', {slug: entry.slug}) }}">{{ entry.name }}</a></h1>
<time>{{ entry.published | format_datetime(dateFormat = 'medium', timeFormat = 'short') }}</time>
<main>
{% if short is defined and short %}
{{ entry.content | striptags() | u.truncate(1000, '…') }}
<p><a href="{{ path('entry', {slug: entry.slug}) }}">Read more …</a></p>
{% else %}
{# TODO: Use something like parsefunc from TYPO3 to output allowed and secured content #}
{# Also in entries.html.twig? But with different configuration #}
{# <main>{{ entry.content | striptags('<p>,<a>,<strong>,<i>,<h1>,<h2>,<h3>,<h4>,<ul>,<li>') | raw }}</main> #}
{{ entry.content | striptags('<p>,<a>,<strong>,<i>,<h1>,<h2>,<h3>,<h4>,<ul>,<li>') | raw }}
{% endif %}
</main>
<nav>
{% if entry.url %}
<a href="{{ entry.url }}" target="_blank"
rel="external nofollow noopener noreferrer"
referrerpolicy="no-referrer">Entry URL</a>
{% endif %}
<a href="{{ entry.feed.url }}" target="_blank"
rel="external nofollow noopener noreferrer"
referrerpolicy="no-referrer">Feed URL</a>
<a href="{{ path('bucket', {slug: entry.feed.bucket.slug}) }}">{{ entry.feed.bucket.name }} bucket</a>
<a href="{{ path('feed', {slug: entry.feed.slug}) }}">{{ entry.feed.name }} feed</a>
</nav>
</article>