Public Access
1
0

feat: enhance blog post view counter with individual tracking and display

This commit is contained in:
2025-08-24 23:36:11 -04:00
parent 9b2f5d5840
commit 3416ee171c
3 changed files with 78 additions and 40 deletions

View File

@@ -9,15 +9,20 @@ eleventyExcludeFromCollections: true
<div class="space-y-8">
{%- for post in collections.general | reverse -%}
<div class="card">
<h2 class="text-2xl font-bold">
<h2 class="text-2xl font-bold mb-1">
<a href="{{ post.url }}" class="text-blue-400 hover:underline">{{ post.data.title }}</a>
</h2>
<p class="text-gray-400 mb-4">
{{ post.date | readableDate }}
</p>
<div class="flex items-center text-gray-400 mb-4">
<i class="fas fa-calendar mr-2"></i>
<p>{{ post.date | readableDate }}</p>
<span class="mx-2 text-gray-600">|</span>
<i class="fas fa-eye mr-2"></i>
<span class="view-count" data-view-count data-slug="{{ post.fileSlug }}">...</span>
</div>
{% if post.data.excerpt %}
<p class="text-gray-300">{{ post.data.excerpt }}</p>
{% endif %}
</div>
{%- endfor -%}
</div>
<script src="/js/view-counter.js"></script>