Skip to content

Commit

Permalink
Auto generate blog rollup
Browse files Browse the repository at this point in the history
Set rollup to true in a post front matter to include it the the recent
publications section in the home page. The last 3 most recent posts with
this value set will get displayed there.

The optional category field can be set and will be displayed above the
post.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
welteki authored and alexellis committed Oct 23, 2024
1 parent 30e6435 commit e22175b
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 158 deletions.
73 changes: 73 additions & 0 deletions _includes/rollup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<div class="bg-white pt-16 pb-20 px-4 sm:px-6 lg:pt-24 lg:pb-28 lg:px-8">
<div
class="relative max-w-lg mx-auto divide-y-2 divide-gray-200 lg:max-w-7xl"
>
<div>
<h2
class="text-3xl tracking-tight font-extrabold text-gray-900 sm:text-4xl"
>
Recent publications
</h2>
<p class="mt-3 text-xl text-gray-500 sm:mt-4">
Read tutorials, watch videos and catch up on new features from the
inlets community.
</p>
</div>

<div
class="mt-12 mb-5 grid gap-16 pt-12 lg:grid-cols-3 lg:gap-x-5 lg:gap-y-12"
>
{% assign rollup_posts = site.posts | where_exp: "post", "post.rollup == true" | sort: 'date' | reverse | slice: 0, 3 %}
{% if rollup_posts.size > 0 %}
{% for post in rollup_posts %}
<div>
{% if post.category %}
<div>
<div class="inline-block">
<span
class="inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium bg-pink-100 text-pink-800"
>
{{ post.category | capitalize_first }}
</span>
</div>
</div>
{% endif %}
<a href="{{ site.base_url }}{{ post.url }}" class="block mt-4">
<p class="text-xl font-semibold text-gray-900">{{ post.title }}</p>
<p class="mt-3 text-base text-gray-500">{{ post.description }}</p>
</a>
<div class="mt-6 flex items-center">
{% if post.author %}
<div class="flex-shrink-0">
<img
class="h-10 w-10 rounded-full"
src="/images/{{ post.author_img }}.jpg"
alt="{{ post.author }}"
alt=""
/>
</div>
{% endif %}

<div class="ml-3">
<p class="text-sm font-medium text-gray-900">{{ post.author }}</p>
<div class="flex space-x-1 text-sm text-gray-500">
<time datetime="2020-03-16"> {{ post.date | date: "%B %e, %Y" }} </time>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>

<div class="pt-5 text-sm">
<a
href="/blog/"
class="font-medium text-indigo-600 hover:text-indigo-500"
>
Read more on the blog <span aria-hidden="true">&rarr;</span></a
>
</div>
</div>
</div>
157 changes: 0 additions & 157 deletions _includes/tutorials.html

This file was deleted.

10 changes: 10 additions & 0 deletions _plugins/capitalize_filter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Jekyll
module CapitalizeFilter
def capitalize_first(input)
input.capitalize
end
end
end

Liquid::Template.register_filter(Jekyll::CapitalizeFilter)

2 changes: 2 additions & 0 deletions blog/_posts/2024-09-02-highly-available-tunnels.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Create Highly Available Tunnels With A Load Balancer
description: Learn how to create a highly available inlets tunnel with a load balancer, and Proxy Protocol support, to get source IP addresses.
author: Alex Ellis
tags: ha architecture reference load-balancer
category: tutorial
rollup: true
author_img: alex
image: /images/2024-09-ha-tunnels/background.png
date: 2024-09-02
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Get Real Client IPs with Ingress Nginx, Caddy or Traefik
description: Whether you're running a reverse proxy directly on a host, or an Ingress Controller in Kubernetes, you can get the real client IP with inlets.
author: Alex Ellis
tags: load-balancer ingress-controller reverse-proxy proxy-protocol
category: tutorial
rollup: true
author_img: alex
image: /images/2024-10-real-ips/background.png
date: 2024-10-08
Expand Down
2 changes: 2 additions & 0 deletions blog/_posts/2024-10-17-ssh-with-inlets-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: SSH Into Any Private Host With Inlets Cloud
description: Inlets Cloud is a SaaS hosted version of inlets that can give you SSH access to any host on your network.
author: Alex Ellis
tags: ssh remoteaccess inletscloud support
category: tutorial
rollup: true
author_img: alex
image: /images/2024-10-inlets-cloud-ssh/background.jpg
date: 2024-10-17
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---
{% include hero.html %}
<div style="padding-bottom: 20px;"></div>
{% include tutorials.html %}
{% include rollup.html %}
<div style="padding-bottom: 20px;"></div>
{% include features.html %}
<div style="padding-bottom: 20px;"></div>
Expand Down

0 comments on commit e22175b

Please sign in to comment.