Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make latest post redirect if the blog post redirects #1451

Merged
merged 2 commits into from
Jun 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion _includes/latest_posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
<tr>
<th scope="row">{{ item.date | date: "%b %-d, %Y" }}</th>
<td>
<a class="news-title" href="{{ item.url | relative_url }}">{{ item.title }}</a>
{% if item.redirect == blank %}
<a class="news-title" href="{{ item.url | relative_url }}">{{ item.title }}</a>
{% elsif item.redirect contains '://' %}
<a class="news-title" href="{{ item.redirect }}" target="_blank">{{ item.title }}</a>
<svg width="2rem" height="2rem" viewBox="0 0 40 40" 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="news-title" href="{{ item.redirect | relative_url }}">{{ item.title }}</a>
{% endif %}
</td>
</tr>
{%- endfor %}
Expand Down
16 changes: 7 additions & 9 deletions blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,14 @@ <h2>{{ site.blog_description }}</h2>
{%- endif -%}
<h3>
{% if post.redirect == blank %}
<a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
<a class="post-title" href="{{ post.url | relative_url }}">{{ post.title }}</a>
{% elsif post.redirect contains '://' %}
<a class="post-title" href="{{ post.redirect }}" target="_blank">{{ post.title }}</a>
<svg width="2rem" height="2rem" viewBox="0 0 40 40" 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 %}
{% if post.redirect contains '://' %}
<a class="post-title" href="{{ post.redirect }}" target="_blank">{{ post.title }}</a>
<svg width="2rem" height="2rem" viewBox="0 0 40 40" 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="post-title" href="{{ post.redirect | relative_url }}">{{ post.title }}</a>
{% endif %}
<a class="post-title" href="{{ post.redirect | relative_url }}">{{ post.title }}</a>
{% endif %}
</h3>
<p>{{ post.description }}</p>
Expand Down