feat: more performant popular posts

This commit is contained in:
Cory Dransfeldt 2024-06-03 18:23:13 -07:00
parent 7e3503fbb4
commit 3ef783fd18
No known key found for this signature in database
11 changed files with 28 additions and 32 deletions

View file

@ -1,6 +1,6 @@
<div class="addon-links">
{%- if analytics.size > 0 -%}
<div>{% render "partials/widgets/popular-posts.liquid", posts:posts, analytics:analytics %}</div>
{%- if popularPosts.size > 0 -%}
<div>{% render "partials/widgets/popular-posts.liquid", popularPosts:popularPosts %}</div>
{%- endif -%}
{%- if links.size > 0 -%}
<div>{% render "partials/widgets/recent-links.liquid", links:links %}</div>

View file

@ -1,11 +1,10 @@
{% assign postData = posts | getPopularPosts: analytics %}
{% if postData.size > 0 %}
{% if popularPosts.size > 0 %}
<h2 class="link-list-header flex-centered">
{% tablericon "flame" "Popular" %}
Popular posts
</h2>
<ul class="link-list">
{% for post in postData limit: 5 %}
{% for post in popularPosts limit: 5 %}
<li>
<a class="no-underline" href="{{ post.slug }}" title="{{ post.title | escape}}">
{{ post.title }}