Skip to content

Commit af806db

Browse files
george-gcaajaynarayanan
authored andcommitted
Fix related external posts (alshedivat#2980)
Fixes alshedivat#2977 Signed-off-by: George Araújo <[email protected]>
1 parent b011d54 commit af806db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

_includes/related_posts.liquid

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@
1313
{% endunless %}
1414

1515
<li class="my-2">
16-
<a class="text-pink-700 underline font-semibold hover:text-pink-800" href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
16+
{% if post.redirect == blank %}
17+
<a class="text-pink-700 underline font-semibold hover:text-pink-800" href="{{ post.url | relative_url }}">{{ post.title }}</a>
18+
{% elsif post.redirect contains '://' %}
19+
<a class="text-pink-700 underline font-semibold hover:text-pink-800" href="{{ post.redirect }}" target="_blank">{{ post.title }}</a>
20+
<svg width="1rem" height="1rem" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
21+
<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>
22+
</svg>
23+
{% else %}
24+
<a class="text-pink-700 underline font-semibold hover:text-pink-800" href="{{ post.redirect | relative_url }}">{{ post.title }}</a>
25+
{% endif %}
1726
</li>
1827
{% endfor %}
1928
{% if site.newsletter.enabled and site.footer_fixed %}

0 commit comments

Comments
 (0)