Remove Untitled fallback in homepage Recent Posts
This commit is contained in:
@@ -81,12 +81,15 @@ withSidebar: true
|
|||||||
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Recent Posts</h2>
|
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Recent Posts</h2>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
{% for post in collections.posts | head(10) %}
|
{% for post in collections.posts | head(10) %}
|
||||||
<article class="p-4 bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 hover:border-accent-400 dark:hover:border-accent-600 transition-colors shadow-sm">
|
<article class="p-4 bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 hover:border-accent-400 dark:hover:border-accent-600 transition-colors shadow-sm">
|
||||||
<h3 class="font-semibold text-surface-900 dark:text-surface-100 mb-1">
|
{% set postTitle = ((post.data.title or post.data.name or "") | trim) %}
|
||||||
<a href="{{ post.url }}" class="hover:text-accent-600 dark:hover:text-accent-400">
|
{% if postTitle %}
|
||||||
{{ post.data.title or post.data.name or "Untitled" }}
|
<h3 class="font-semibold text-surface-900 dark:text-surface-100 mb-1">
|
||||||
</a>
|
<a href="{{ post.url }}" class="hover:text-accent-600 dark:hover:text-accent-400">
|
||||||
</h3>
|
{{ postTitle }}
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
{% endif %}
|
||||||
{% if post.data.summary %}
|
{% if post.data.summary %}
|
||||||
<p class="text-sm text-surface-600 dark:text-surface-400 mb-2 line-clamp-2">{{ post.data.summary }}</p>
|
<p class="text-sm text-surface-600 dark:text-surface-400 mb-2 line-clamp-2">{{ post.data.summary }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -94,6 +97,9 @@ withSidebar: true
|
|||||||
<time class="font-mono" datetime="{{ post.data.published or post.date }}">
|
<time class="font-mono" datetime="{{ post.data.published or post.date }}">
|
||||||
{{ (post.data.published or post.date) | date("MMM d, yyyy") }}
|
{{ (post.data.published or post.date) | date("MMM d, yyyy") }}
|
||||||
</time>
|
</time>
|
||||||
|
{% if not postTitle %}
|
||||||
|
<a href="{{ post.url }}" class="text-accent-600 dark:text-accent-400 hover:underline">Permalink</a>
|
||||||
|
{% endif %}
|
||||||
{% if post.data.postType %}
|
{% if post.data.postType %}
|
||||||
<span class="px-2 py-0.5 bg-surface-100 dark:bg-surface-700 rounded-full">{{ post.data.postType }}</span>
|
<span class="px-2 py-0.5 bg-surface-100 dark:bg-surface-700 rounded-full">{{ post.data.postType }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -79,12 +79,15 @@ withSidebar: true
|
|||||||
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Recent Posts</h2>
|
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Recent Posts</h2>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
{% for post in collections.posts | head(10) %}
|
{% for post in collections.posts | head(10) %}
|
||||||
<article class="p-4 bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 hover:border-accent-400 dark:hover:border-accent-600 transition-colors">
|
<article class="p-4 bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 hover:border-accent-400 dark:hover:border-accent-600 transition-colors">
|
||||||
<h3 class="font-semibold text-surface-900 dark:text-surface-100 mb-1">
|
{% set postTitle = ((post.data.title or post.data.name or "") | trim) %}
|
||||||
<a href="{{ post.url }}" class="hover:text-accent-600 dark:hover:text-accent-400">
|
{% if postTitle %}
|
||||||
{{ post.data.title or post.data.name or "Untitled" }}
|
<h3 class="font-semibold text-surface-900 dark:text-surface-100 mb-1">
|
||||||
</a>
|
<a href="{{ post.url }}" class="hover:text-accent-600 dark:hover:text-accent-400">
|
||||||
</h3>
|
{{ postTitle }}
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
{% endif %}
|
||||||
{% if post.data.summary %}
|
{% if post.data.summary %}
|
||||||
<p class="text-sm text-surface-600 dark:text-surface-400 mb-2 line-clamp-2">{{ post.data.summary }}</p>
|
<p class="text-sm text-surface-600 dark:text-surface-400 mb-2 line-clamp-2">{{ post.data.summary }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -92,6 +95,9 @@ withSidebar: true
|
|||||||
<time datetime="{{ post.data.published or post.date }}">
|
<time datetime="{{ post.data.published or post.date }}">
|
||||||
{{ (post.data.published or post.date) | date("MMM d, yyyy") }}
|
{{ (post.data.published or post.date) | date("MMM d, yyyy") }}
|
||||||
</time>
|
</time>
|
||||||
|
{% if not postTitle %}
|
||||||
|
<a href="{{ post.url }}" class="text-accent-600 dark:text-accent-400 hover:underline">Permalink</a>
|
||||||
|
{% endif %}
|
||||||
{% if post.data.postType %}
|
{% if post.data.postType %}
|
||||||
<span class="px-2 py-0.5 bg-surface-100 dark:bg-surface-700 rounded">{{ post.data.postType }}</span>
|
<span class="px-2 py-0.5 bg-surface-100 dark:bg-surface-700 rounded">{{ post.data.postType }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user