Add configurable comment links section
This commit is contained in:
parent
a3d2d86d2c
commit
55f912995e
|
@ -7,8 +7,12 @@ categories = ["blog"]
|
|||
tags = ["rust", "performance", "aoc"]
|
||||
|
||||
[extra]
|
||||
comments = true
|
||||
zenn_applause = true
|
||||
comments = [
|
||||
{url = "https://news.ycombinator.org/", name = "Hackernews"},
|
||||
{url = "https://reddit.com/", name = "Reddit"},
|
||||
{url = "https://lobste.rs/", name = "Lobsters"},
|
||||
]
|
||||
+++
|
||||
|
||||
```
|
||||
|
|
|
@ -17,11 +17,34 @@
|
|||
{{ page.content | safe }}
|
||||
</div>
|
||||
|
||||
{# Comments header #}
|
||||
{% if page.extra.comments %}
|
||||
<h2 id="comments">Comments</h2>
|
||||
{% endif %}
|
||||
|
||||
{# Applause button #}
|
||||
{% if page.extra.zenn_applause %}
|
||||
<div class="applause-wrapper">
|
||||
<applause-button color="#a6a28c" url="{{ page.permalink | safe }}"></applause-button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Comments #}
|
||||
{% if page.extra.comments %}
|
||||
<p>
|
||||
Comments on
|
||||
{% for page in page.extra.comments %}
|
||||
<a href="{{ page.url | safe }}" target="_blank">{{ page.name }}</a>
|
||||
{%- if not loop.last -%}
|
||||
{% if loop.index == page.extra.comments | length - 1%}
|
||||
&
|
||||
{% else -%}
|
||||
,
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endblock body %}
|
||||
|
||||
|
|
|
@ -190,6 +190,11 @@
|
|||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{# Comments link #}
|
||||
{% if page.extra.comments %}
|
||||
<li><a href="#comments" title="Comments">Comments</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</section>
|
||||
{%- endif %}
|
||||
|
|
Loading…
Reference in New Issue