pages/_includes/related_posts.liquid
Abhilesh Dhawanjewar 47b982bd0d
Add sidenote examples, related posts and giscus to distill posts (#3103)
This PR adds a few stylistic improvements to the distill-style blog
posts:

- Update distill blog post example to showcase sidenotes as an
alternative to styles in PR #3077
- Showcase equations in sidenotes (closes #1242)
- Add `overrides.js` to match footnotes and citation styles with global
theme styling
- Add "related posts" sections if enabled to distill style posts
- Add "giscus" section if enabled to distill style posts



https://github.com/user-attachments/assets/b19a9cd9-779d-4d89-a4fb-eb14fb384480
2025-07-16 15:07:42 -03:00

37 lines
1.7 KiB
Plaintext

{% assign have_related_posts = false %}
{% for post in site.related_posts | limit: site.related_blog_posts.max_related %}
{% unless have_related_posts %}
{% assign have_related_posts = true %}
{% if page.layout == 'post' %}
<br>
<hr>
<br>
<ul class="list-disc pl-8"></ul>
<!-- Adds related posts to the end of an article -->
<h2 class="text-3xl font-semibold mb-4 mt-12">Enjoy Reading This Article?</h2>
{% else %}
<h2 class="text-3xl font-semibold mb-4 mt-12">Enjoy Reading This Article?</h2>
{% endif %}
<p class="mb-2">Here are some more articles you might like to read next:</p>
{% endunless %}
<li class="my-2">
{% if post.redirect == blank %}
<a class="text-pink-700 underline font-semibold hover:text-pink-800" href="{{ post.url | relative_url }}">{{ post.title }}</a>
{% elsif post.redirect contains '://' %}
<a class="text-pink-700 underline font-semibold hover:text-pink-800" href="{{ post.redirect }}" target="_blank">{{ post.title }}</a>
<svg width="1rem" height="1rem" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg">
<path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#999" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
{% else %}
<a class="text-pink-700 underline font-semibold hover:text-pink-800" href="{{ post.redirect | relative_url }}">{{ post.title }}</a>
{% endif %}
</li>
{% endfor %}
{% if site.newsletter.enabled and site.footer_fixed %}
<p class="mb-2" style="margin-top: 1.5rem !important">Subscribe to be notified of future articles:</p>
{% include newsletter.liquid left=true %}
{% endif %}