feat: restore link widgets
This commit is contained in:
parent
d813bd505f
commit
5911b30917
18 changed files with 319 additions and 17 deletions
9
src/includes/blocks/addon-links.liquid
Normal file
9
src/includes/blocks/addon-links.liquid
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
<div class="addon-links">
|
||||
{%- if popularPosts.size > 0 -%}
|
||||
{% render "blocks/popular-posts.liquid", popularPosts:popularPosts %}
|
||||
{%- endif -%}
|
||||
{%- if links.size > 0 -%}
|
||||
{% render "blocks/recent-links.liquid", links:links %}
|
||||
{%- endif -%}
|
||||
</div>
|
|
@ -14,5 +14,7 @@
|
|||
{{ block.text | markdown }}
|
||||
{%- when 'divider' -%}
|
||||
{{ block.markup | markdown }}
|
||||
{%- when 'addon_links' -%}
|
||||
{% render "blocks/addon-links.liquid", popularPosts:collections.popularPosts, links:links %}
|
||||
{%- endcase -%}
|
||||
{%- endfor -%}
|
15
src/includes/blocks/popular-posts.liquid
Normal file
15
src/includes/blocks/popular-posts.liquid
Normal file
|
@ -0,0 +1,15 @@
|
|||
{%- if popularPosts.size > 0 -%}
|
||||
<article>
|
||||
<h3 class="article">
|
||||
{% tablericon "chart-bar-popular" "Popular" %}
|
||||
Popular posts
|
||||
</h3>
|
||||
<ol type="1">
|
||||
{%- for post in popularPosts limit: 5 -%}
|
||||
<li>
|
||||
<a href="{{ post.url }}">{{ post.title }}</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ol>
|
||||
</article>
|
||||
{%- endif -%}
|
18
src/includes/blocks/recent-links.liquid
Normal file
18
src/includes/blocks/recent-links.liquid
Normal file
|
@ -0,0 +1,18 @@
|
|||
{%- if links.size > 0 -%}
|
||||
<article>
|
||||
<h3 class="link">
|
||||
{% tablericon "link" "Links" %}
|
||||
Recent links
|
||||
</h3>
|
||||
<ul>
|
||||
{%- for link in links limit: 5 -%}
|
||||
<li>
|
||||
<a href="{{ link.link }}" title="{{ link.title | escape }}">
|
||||
{{ link.title }}
|
||||
</a>
|
||||
{% if link.author %} via <a href="{{ link.author.url }}">{{ link.author.name }}</a>{% endif %}
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</article>
|
||||
{%- endif -%}
|
Reference in a new issue