Files
indiekit-blog/_includes/components/widgets/recent-posts.njk
rmdes 32aea5ace9 feat: neutralize theme for fresh deployments
Strip personal data from templates so the theme ships clean for any
deployer. Collection pages now use generatePageOnEmptyData so empty
post types show encouraging placeholders instead of 404s. Navigation
is conditional on enabled post types and installed plugins. Sidebar
widgets split into individual components with plugin-aware visibility.
Slashes page explains required plugins for root-level page creation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:16:29 +01:00

22 lines
753 B
Plaintext

{# Recent Posts Widget (for non-blog pages) #}
{% if recentPosts and recentPosts.length %}
<div class="widget">
<h3 class="widget-title">Recent Posts</h3>
<ul class="space-y-2">
{% for post in recentPosts | head(5) %}
<li>
<a href="{{ post.url }}" class="text-sm text-primary-600 dark:text-primary-400 hover:underline">
{{ post.data.title or post.data.name or "Untitled" }}
</a>
<time class="text-xs text-surface-500 block" datetime="{{ post.data.published }}">
{{ post.data.published | date("MMM d, yyyy") }}
</time>
</li>
{% endfor %}
</ul>
<a href="/posts/" class="text-sm text-primary-600 dark:text-primary-400 hover:underline mt-3 block">
View all posts
</a>
</div>
{% endif %}