chore: dry up webmentions
This commit is contained in:
parent
561bf48c74
commit
f3faf8feab
10 changed files with 70 additions and 71 deletions
16
src/_includes/partials/webmentions/comments.liquid
Normal file
16
src/_includes/partials/webmentions/comments.liquid
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% if mentions['in-reply-to'].size > 0 %}
|
||||
<h2 class="text-lg md:text-xl font-black leading-tight dark:text-gray-200">Comments</h2>
|
||||
<div class="mt-4 flex flex-col items-center not-prose">
|
||||
{% for mention in mentions['in-reply-to'] %}
|
||||
<div class="border-bottom flex flex-row items-center border-gray-100 pb-4 w-full">
|
||||
<a class="text-gray-700 dark:text-gray-200 group flex flex-row space-between items-center" href={{mention.url}}>
|
||||
{% image mention.author.photo, mention.author.name, 'bg-gray-900 dark:bg-white h-14 w-14 rounded-full border-4 border-white dark:border-gray-900 transition-all ease-in-out duration-300 group-hover:border-pink-500 dark:group-hover:border-pink-500', '56px' %}
|
||||
<div class="ml-3">
|
||||
<p class="text-sm group-hover:text-pink-500 dark:group-hover:text-pink-500">{{ mention.content.text }}</p>
|
||||
<p class="mt-1 text-xs group-hover:text-pink-500 dark:group-hover:text-pink-500">{{ mention.published | isoDateOnly }}</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
8
src/_includes/partials/webmentions/container.liquid
Normal file
8
src/_includes/partials/webmentions/container.liquid
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% if webmentions %}
|
||||
<div class="border-t border-gray-200 mt-12 pt-14 dark:border-gray-700">
|
||||
{% assign mentions = webmentions.mentions | webmentionsByUrl: page.url %}
|
||||
{% render "partials/webmentions/interaction.liquid", mentions: mentions, type: 'repost-of' %}
|
||||
{% render "partials/webmentions/interaction.liquid", mentions: mentions, type: 'like-of' %}
|
||||
{% render "partials/webmentions/comments.liquid", mentions: mentions %}
|
||||
</div>
|
||||
{% endif %}
|
21
src/_includes/partials/webmentions/interaction.liquid
Normal file
21
src/_includes/partials/webmentions/interaction.liquid
Normal file
|
@ -0,0 +1,21 @@
|
|||
{%- capture title %}
|
||||
{% if type == 'repost-of' %}
|
||||
Reposts
|
||||
{% elsif type == 'like-of' %}
|
||||
Likes
|
||||
{% endif %}
|
||||
{% endcapture -%}
|
||||
{% if mentions[type].size > 0 %}
|
||||
<h2 class="text-lg md:text-xl font-black leading-tight dark:text-gray-200">{{ title }}</h2>
|
||||
<div class="flex flex-row items-center mt-4 mb-6">
|
||||
<ul class="ml-3 flex flex-row flex-wrap">
|
||||
{% for mention in mentions[type] %}
|
||||
<li class="-ml-3 inline">
|
||||
<a href={{mention.url}}>
|
||||
{% image mention.author.photo, mention.author.name, 'bg-gray-900 dark:bg-white h-14 w-14 rounded-full border-4 border-white dark:border-gray-900 transition-all hover:border-pink-500 dark:hover:border-pink-500', '56px' %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
Reference in a new issue