Skip to content

Commit

Permalink
fix destructive manipulation of the published episodes collection
Browse files Browse the repository at this point in the history
  • Loading branch information
lmammino committed Jan 9, 2025
1 parent c210062 commit b33c54b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addCollection('publishedEpisodes', function (collectionApi) {
// get episodes, sorted by publish date, descending
return collectionApi.getFilteredByTag('episode')
.filter((item) => item.data.publish_date <= now)
.filter((item) => item.data.publish_date <= item.data.settings.now)
.sort((a, b) => a.data.publish_date - b.data.publish_date)
})

Expand Down
47 changes: 0 additions & 47 deletions src/episodes/137-how-to-become-a-cloud-architect.md

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ is_generic: true
{% set publishedEpisodes = collections
.publishedEpisodes
.reverse() %}
{% set lastEpisode = publishedEpisodes.shift() %}
{% set lastEpisode = publishedEpisodes[0] %}

<div class="my-8">
<h2 class="text-gray-900 dark:text-gray-100 text-xl lg:text-2xl font-bold mb-4">Latest episodes</h2>
Expand Down Expand Up @@ -124,7 +124,7 @@ is_generic: true

<div class="my-8">
<ol class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8">
{% for episode in publishedEpisodes %}
{% for episode in publishedEpisodes.slice(1) %}
<li class="flex flex-1">
<a href="{{episode.url}}" class="text-lg font-bold text-gray-900 dark:text-gray-100 hover:text-primary-600 dark:hover:text-secondary-400 flex flex-1">
<div class="bg-white dark:bg-slate-800 rounded-sm overflow-hidden shadow-sm">
Expand Down

0 comments on commit b33c54b

Please sign in to comment.