website-htmx-rustelo-code/crates/pages_htmx/templates/pages/post.j2
2026-07-10 03:44:13 +01:00

39 lines
1.7 KiB
Django/Jinja

{# Content post viewer — website override of the framework post.j2.
Differences from the framework default:
- No max-w-3xl / mx-auto on article (column width already constrained by grid).
- post-content-body on the prose div so the lead-image CSS rule applies.
- overflow-hidden on article to prevent images from bleeding into the sidebar. #}
<article class="w-full overflow-hidden px-4 py-8" itemscope itemtype="https://schema.org/Article">
{% include "partials/content_header.j2" %}
{% if item.excerpt %}
<div class="text-lg ds-text-muted leading-relaxed mb-8 border-l-4 border-current pl-4 italic">
{{ item.excerpt }}
</div>
{% endif %}
<div class="prose prose-neutral dark:prose-invert max-w-none ds-text leading-relaxed post-content-body" itemprop="articleBody">
{{ body_html | safe }}
</div>
{% if item.translations and item.translations | length > 1 %}
<footer class="mt-12 pt-6 border-t border-gray-200 dark:border-gray-700">
<p class="text-sm ds-text-muted">
{% if lang == "es" %}También disponible en:{% else %}Also available in:{% endif %}
{% for tlang in item.translations %}
{% if tlang != lang %}
{% set tslug = item.translation_slugs[tlang] %}
<a href="/{{ tlang }}/{{ item.content_type }}/{{ tslug }}"
class="underline hover:ds-text"
hx-get="/{{ tlang }}/{{ item.content_type }}/{{ tslug }}"
hx-target="#main-content"
hx-swap="innerHTML"
hx-push-url="true">{{ tlang | upper }}</a>
{% endif %}
{% endfor %}
</p>
</footer>
{% endif %}
</article>
{% include "partials/image-zoom.j2" %}