feat: title links on posts in lists

This commit is contained in:
2026-02-22 10:50:48 +01:00
parent 0172e468ba
commit b166dd5a81
4 changed files with 16 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ export interface HtmlRewriteContext {
export interface TemplatePostEntry {
id: string;
slug: string;
title: string;
content: string;
show_title: boolean;
@@ -896,6 +897,7 @@ export class PageRenderer {
show_separator: false,
posts: posts.map((post) => ({
id: post.id,
slug: post.slug,
title: post.title,
content: post.content,
show_title: shouldShowListTitle(post),
@@ -921,6 +923,7 @@ export class PageRenderer {
currentBlock.block.posts.push({
id: post.id,
slug: post.slug,
title: post.title,
content: post.content,
show_title: shouldShowListTitle(post),
@@ -1074,6 +1077,7 @@ export class PageRenderer {
menu_items: pageContext.menu_items ?? [],
post: {
id: renderablePost.id,
slug: renderablePost.slug,
title: renderablePost.title,
content: renderablePost.content,
show_title: false,

View File

@@ -38,7 +38,11 @@
{% for post in day_block.posts %}
<div class="post">
{% if post.show_title %}
<h2 class="post-title">{{ post.title }}</h2>
{% assign canonical_post_href = canonical_post_path_by_slug[post.slug] %}
{% if canonical_post_href == blank %}
{% assign canonical_post_href = '/posts/' | append: post.slug %}
{% endif %}
<h2 class="post-title"><a href="{{ canonical_post_href }}">{{ post.title }}</a></h2>
{% endif %}
{{ post.content | markdown: post.id, canonical_post_path_by_slug, canonical_media_path_by_source_path, language }}
</div>
@@ -49,7 +53,11 @@
{% for post in day_block.posts %}
<div class="post">
{% if post.show_title %}
<h2 class="post-title">{{ post.title }}</h2>
{% assign canonical_post_href = canonical_post_path_by_slug[post.slug] %}
{% if canonical_post_href == blank %}
{% assign canonical_post_href = '/posts/' | append: post.slug %}
{% endif %}
<h2 class="post-title"><a href="{{ canonical_post_href }}">{{ post.title }}</a></h2>
{% endif %}
{{ post.content | markdown: post.id, canonical_post_path_by_slug, canonical_media_path_by_source_path, language }}
</div>