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:
@@ -28,10 +28,10 @@
|
||||
</time>
|
||||
{% if page.header.location_city or page.header.location_country %}
|
||||
<p class="entry-location">
|
||||
📍
|
||||
{% if page.header.location_city %}{{ page.header.location_city }}{% endif %}
|
||||
{% if page.header.location_city and page.header.location_country %}, {% endif %}
|
||||
{% if page.header.location_country %}{{ page.header.location_country }}{% endif %}
|
||||
{%- set _loc = [] -%}
|
||||
{%- if page.header.location_city -%}{%- set _loc = _loc|merge([page.header.location_city]) -%}{%- endif -%}
|
||||
{%- if page.header.location_country -%}{%- set _loc = _loc|merge([page.header.location_country]) -%}{%- endif -%}
|
||||
📍 {{ _loc|join(', ') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if page.header.weather_desc or page.header.weather_temp_c %}
|
||||
@@ -51,7 +51,7 @@
|
||||
</header>
|
||||
|
||||
<div class="entry-body">
|
||||
{{ page.content }}
|
||||
{{ page.content|raw }}
|
||||
</div>
|
||||
|
||||
{% set images = page.media.images %}
|
||||
|
||||
@@ -97,10 +97,10 @@ if (latLngs.length === 1) {
|
||||
</time>
|
||||
{% if entry.header.location_city or entry.header.location_country %}
|
||||
<span class="entry-location-plain">
|
||||
📍
|
||||
{% if entry.header.location_city %}{{ entry.header.location_city }}{% endif %}
|
||||
{% if entry.header.location_city and entry.header.location_country %}, {% endif %}
|
||||
{% if entry.header.location_country %}{{ entry.header.location_country }}{% endif %}
|
||||
{%- set _loc = [] -%}
|
||||
{%- if entry.header.location_city -%}{%- set _loc = _loc|merge([entry.header.location_city]) -%}{%- endif -%}
|
||||
{%- if entry.header.location_country -%}{%- set _loc = _loc|merge([entry.header.location_country]) -%}{%- endif -%}
|
||||
📍 {{ _loc|join(', ') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -108,7 +108,7 @@ if (latLngs.length === 1) {
|
||||
|
||||
<div class="entry-card-body">
|
||||
<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>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user