feat: more performant popular posts
This commit is contained in:
parent
7e3503fbb4
commit
3ef783fd18
11 changed files with 28 additions and 32 deletions
|
@ -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>
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -380,9 +380,6 @@ main {
|
|||
.home-status,
|
||||
article {
|
||||
margin-bottom: var(--sizing-base);
|
||||
}
|
||||
|
||||
.home-status {
|
||||
border-bottom: 1px solid var(--gray-light);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,5 +30,5 @@ image: /assets/img/404.jpg
|
|||
What kind of idiots do you have working here? <a href="/">Hurry up and skip out on the room service bill!</a>
|
||||
</div>
|
||||
<hr class="large-spacing" />
|
||||
{% render "partials/widgets/addon-links.liquid", posts:posts, analytics:analytics, links:collections.links %}
|
||||
{% render "partials/widgets/addon-links.liquid", popularPosts:collections.popularPosts, links:links %}
|
||||
</div>
|
|
@ -22,4 +22,5 @@ schema: blog
|
|||
{{ post.content | markdown }}
|
||||
{% render "partials/posts/blocks.liquid", blocks:post.blocks %}
|
||||
</div>
|
||||
</article>
|
||||
</article>
|
||||
{% render "partials/widgets/addon-links.liquid", popularPosts:collections.popularPosts, links:links %}
|
|
@ -55,4 +55,4 @@ permalink: /search.html
|
|||
<input class="search__form--fallback" type="hidden" placeholder="Search" name="sites" value="coryd.dev">
|
||||
</form>
|
||||
<ul class="search__results hidden"></ul>
|
||||
{% render "partials/widgets/addon-links.liquid", posts:posts, analytics:analytics, links:links %}
|
||||
{% render "partials/widgets/addon-links.liquid", popularPosts:collections.popularPosts, links:links %}
|
|
@ -9,4 +9,4 @@ description: I'll be in touch soon. Thanks for your message!
|
|||
I'll be in touch soon! <a href="/">Head home</a>
|
||||
</div>
|
||||
<hr class="large-spacing" />
|
||||
{% render "partials/widgets/addon-links.liquid", posts:posts, analytics:analytics, links:links %}
|
||||
{% render "partials/widgets/addon-links.liquid", popularPosts:collections.popularPosts, links:links %}
|
Reference in a new issue