mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-14 22:48:50 +02:00
feat: configurable post-graph section and dedicated /graph page
- Add posting-activity.njk section template with configurable years/limit - Register posting-activity in homepage-section.njk dispatcher - Move hardcoded post-graph into Tier 2 block (homepage builder controls its own) - Add "View full history" link to /graph/ on both Tier 2 and section template - Create /graph/ page showing all years with no limit Confab-Link: http://localhost:8080/sessions/edb1b7b0-da66-4486-bd9c-d1cfa7553b88
This commit is contained in:
@@ -49,6 +49,8 @@
|
|||||||
{% include "components/sections/funkwhale.njk" ignore missing %}
|
{% include "components/sections/funkwhale.njk" ignore missing %}
|
||||||
{% elif section.type == "lastfm" %}
|
{% elif section.type == "lastfm" %}
|
||||||
{% include "components/sections/lastfm.njk" ignore missing %}
|
{% include "components/sections/lastfm.njk" ignore missing %}
|
||||||
|
{% elif section.type == "posting-activity" %}
|
||||||
|
{% include "components/sections/posting-activity.njk" ignore missing %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- Unknown section type: {{ section.type }} -->
|
<!-- Unknown section type: {{ section.type }} -->
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{# Posting Activity Section — configurable post-graph contribution grid #}
|
||||||
|
{% set sectionConfig = section.config or {} %}
|
||||||
|
{% set graphTitle = sectionConfig.title or "Posting Activity" %}
|
||||||
|
|
||||||
|
{% if collections.posts and collections.posts.length %}
|
||||||
|
<section class="mb-8 sm:mb-12">
|
||||||
|
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">
|
||||||
|
{{ graphTitle }}
|
||||||
|
</h2>
|
||||||
|
{% set graphOptions = {} %}
|
||||||
|
{% if sectionConfig.years and sectionConfig.years.length %}
|
||||||
|
{% set graphOptions = { only: sectionConfig.years } %}
|
||||||
|
{% elif sectionConfig.limit %}
|
||||||
|
{% set graphOptions = { limit: sectionConfig.limit } %}
|
||||||
|
{% endif %}
|
||||||
|
{% postGraph collections.posts, graphOptions %}
|
||||||
|
<a href="/graph/" class="text-sm text-accent-600 dark:text-accent-400 hover:underline mt-4 inline-flex items-center gap-1">
|
||||||
|
View full history
|
||||||
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
@@ -140,12 +140,18 @@ withSidebar: true
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% endif %} {# end two-tier fallback #}
|
{# Posting Activity — contribution graph (Tier 2 default only) #}
|
||||||
|
|
||||||
{# Posting Activity — contribution graph (shown on all homepage variants) #}
|
|
||||||
{% if collections.posts and collections.posts.length %}
|
{% if collections.posts and collections.posts.length %}
|
||||||
<section class="mb-8 sm:mb-12">
|
<section class="mb-8 sm:mb-12">
|
||||||
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Posting Activity</h2>
|
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6">Posting Activity</h2>
|
||||||
{% postGraph collections.posts %}
|
{% postGraph collections.posts %}
|
||||||
|
<a href="/graph/" class="text-sm text-accent-600 dark:text-accent-400 hover:underline mt-4 inline-flex items-center gap-1">
|
||||||
|
View full history
|
||||||
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %} {# end two-tier fallback #}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
layout: layouts/base.njk
|
||||||
|
title: Posting Activity
|
||||||
|
permalink: /graph/
|
||||||
|
withSidebar: true
|
||||||
|
---
|
||||||
|
|
||||||
|
<h1 class="text-2xl sm:text-3xl font-bold text-surface-900 dark:text-surface-100 mb-6">Posting Activity</h1>
|
||||||
|
|
||||||
|
<p class="text-surface-600 dark:text-surface-400 mb-8">
|
||||||
|
A contribution-style graph showing posting frequency across all years.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if collections.posts and collections.posts.length %}
|
||||||
|
{% postGraph collections.posts, { limit: 0 } %}
|
||||||
|
{% else %}
|
||||||
|
<p class="text-surface-500 dark:text-surface-400">No posts found.</p>
|
||||||
|
{% endif %}
|
||||||
Reference in New Issue
Block a user