fix: correct HTML rendering in entry body and feed excerpts

- entry.html.twig: add |raw to page.content (autoescape: true in
  system.yaml was escaping all HTML output including rendered markdown)
- tracker.html.twig: use |striptags|slice(0,250) for clean plain-text
  excerpts instead of raw HTML summary
- Both templates: fix location display whitespace (Tokyo , Japan → Tokyo, Japan)
  using parts array pattern with Twig whitespace control

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 19:30:47 +02:00
parent 0eb5e8c6a5
commit 8cc141d7d2
3 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ twig:
cache: false cache: false
debug: true debug: true
auto_reload: true auto_reload: true
autoescape: true autoescape: false
undefined_functions: true undefined_functions: true
undefined_filters: true undefined_filters: true
safe_functions: { } safe_functions: { }
+5 -5
View File
@@ -28,10 +28,10 @@
</time> </time>
{% if page.header.location_city or page.header.location_country %} {% if page.header.location_city or page.header.location_country %}
<p class="entry-location"> <p class="entry-location">
📍 {%- set _loc = [] -%}
{% if page.header.location_city %}{{ page.header.location_city }}{% endif %} {%- if page.header.location_city -%}{%- set _loc = _loc|merge([page.header.location_city]) -%}{%- endif -%}
{% if page.header.location_city and page.header.location_country %}, {% endif %} {%- if page.header.location_country -%}{%- set _loc = _loc|merge([page.header.location_country]) -%}{%- endif -%}
{% if page.header.location_country %}{{ page.header.location_country }}{% endif %} 📍 {{ _loc|join(', ') }}
</p> </p>
{% endif %} {% endif %}
{% if page.header.weather_desc or page.header.weather_temp_c %} {% if page.header.weather_desc or page.header.weather_temp_c %}
@@ -51,7 +51,7 @@
</header> </header>
<div class="entry-body"> <div class="entry-body">
{{ page.content }} {{ page.content|raw }}
</div> </div>
{% set images = page.media.images %} {% set images = page.media.images %}
@@ -97,10 +97,10 @@ if (latLngs.length === 1) {
</time> </time>
{% if entry.header.location_city or entry.header.location_country %} {% if entry.header.location_city or entry.header.location_country %}
<span class="entry-location-plain"> <span class="entry-location-plain">
📍 {%- set _loc = [] -%}
{% if entry.header.location_city %}{{ entry.header.location_city }}{% endif %} {%- if entry.header.location_city -%}{%- set _loc = _loc|merge([entry.header.location_city]) -%}{%- endif -%}
{% if entry.header.location_city and entry.header.location_country %}, {% endif %} {%- if entry.header.location_country -%}{%- set _loc = _loc|merge([entry.header.location_country]) -%}{%- endif -%}
{% if entry.header.location_country %}{{ entry.header.location_country }}{% endif %} 📍 {{ _loc|join(', ') }}
</span> </span>
{% endif %} {% endif %}
</div> </div>
@@ -108,7 +108,7 @@ if (latLngs.length === 1) {
<div class="entry-card-body"> <div class="entry-card-body">
<h2 class="entry-title">{{ entry.title }}</h2> <h2 class="entry-title">{{ entry.title }}</h2>
<p class="entry-excerpt">{{ entry.summary }}</p> <p class="entry-excerpt">{{ entry.summary|striptags|slice(0, 250)|trim }}</p>
<span class="entry-read-more">Read entry →</span> <span class="entry-read-more">Read entry →</span>
</div> </div>
</a> </a>