Files
slim-blog/views/pages/post/detail.twig
2026-03-16 01:47:07 +01:00

49 lines
1.5 KiB
Twig
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "layout.twig" %}
{% block title %}{{ post.title }} Slim Blog{% endblock %}
{% block meta %}
{% set excerpt = post_excerpt(post, 160) %}
{% set thumb = post_thumbnail(post) %}
<meta name="description" content="{{ excerpt }}">
<meta property="og:type" content="article">
<meta property="og:title" content="{{ post.title }}">
<meta property="og:description" content="{{ excerpt }}">
<meta property="og:url" content="{{ app_url }}{{ post_url(post) }}">
{% if thumb %}
<meta property="og:image" content="{{ app_url }}{{ thumb }}">
{% endif %}
{% endblock %}
{% block content %}
<article class="post">
<h1>{{ post.title }}</h1>
<div class="post__meta">
<small>
Publié le {{ post.createdAt|date("d/m/Y à H:i") }}
par <strong>{{ post.authorUsername ?? 'inconnu' }}</strong>
</small>
{% if post.categoryName %}
<a href="/?categorie={{ post.categorySlug }}" class="badge badge--category">{{ post.categoryName }}</a>
{% endif %}
</div>
{% if post.updatedAt != post.createdAt %}
<div class="post__updated">
<small><em>Mis à jour le {{ post.updatedAt|date("d/m/Y à H:i") }}</em></small>
</div>
{% endif %}
<div class="post__content">
{# Le contenu est déjà sanitisé par HtmlSanitizer via PostService #}
{{ post.content|raw }}
</div>
<hr>
<p>
<a href="/">← Retour aux articles</a>
</p>
</article>
{% endblock %}