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

[current] medium rss changed #731

Merged
merged 1 commit into from
Dec 6, 2023
Merged
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
15 changes: 6 additions & 9 deletions layouts/shortcodes/blog.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{- $maxBlogPosts := 3 }}
{{/*expTimestamp: expire content every 1hour (6000s)*/}}
{{- $expTimestamp := div now.Unix 6000 }}
{{- $mediumURL := printf "https://api.rss2json.com/v1/api.json?timestamp=%d&rss_url=https://medium.com/feed/kialiproject" $expTimestamp }}
{{- $mediumURL := "https://www.toptal.com/developers/feed2json/convert?url=https://medium.com/feed/kialiproject" }}
{{- $json := getJSON $mediumURL }}
{{- $posts := first $maxBlogPosts $json.items }}
{{- $latestPost := index $json.items 1 }}
Expand All @@ -14,17 +12,16 @@ <h3 class="blog-header">
</h3>

{{ range $posts }}
{{ $link := .link }}
{{ $img := .thumbnail }}
{{ $link := .url }}
{{ $title := .title }}
{{ $author := .author }}
{{ $dateRaw := .pubDate }}
{{ $author := .author.name }}
{{ $dateRaw := .date_published }}
{{ $date := dateFormat "January 2, 2006" $dateRaw }}
{{ $summary := .content | plainify | truncate 200 }}
{{ $summary := .content_html | plainify | truncate 200 }}
<div class="col-lg-4 mb-5 mb-lg-0 text-center ">
<div class="blog-card">
<figure>
<img src="{{ $img }}" alt="Thumbnail for {{ $title }}" width="250" height="125">
<img src="/featured-background.png" alt="{{ $title }}" />
</figure>
<div class="blog-card-body">
<div class="blog-card-date">Posted {{ $date }}</div>
Expand Down