diff --git a/.eleventy.js b/.eleventy.js index 0d4567b7e6..d22353a162 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -119,6 +119,14 @@ module.exports = function (eleventyConfig) { eleventyConfig.addFilter("urlExists", (url, collection) => { return Boolean(collection?.find(({ page }) => page.url === url)); }); + + eleventyConfig.addFilter("future", collection => { + return collection.filter(item => { + if (Number.isNaN(Date.parse(item.endDate))) return console.log("Workshop has invalid date!"); + return Date.parse(item.endDate) > new Date(); + }); + }); + /* * Add Transforms * diff --git a/collections/tagsPostsPaged.js b/collections/tagsPostsPaged.js index 5277b5c805..e97ce45720 100644 --- a/collections/tagsPostsPaged.js +++ b/collections/tagsPostsPaged.js @@ -1,5 +1,6 @@ const config = require("../src/_data/config"); const sortByDate = require("../utils/sortByDate"); +const livePosts = require("./posts"); module.exports = collection => { const tagList = require("./tags")(collection); @@ -7,8 +8,15 @@ module.exports = collection => { const maxPostsPerPage = config.maxPostsPerPage; const pagedPosts = []; + const allPosts = livePosts(collection); + Object.keys(tagList).forEach(tagName => { - const sortedPosts = [...collection.getFilteredByTag(tagName)].sort(sortByDate("desc")); + const filtered = allPosts.filter(post => { + if (post.data.tags.length > 0) { + return post?.data?.tags?.includes(tagName); + } + }); + const sortedPosts = filtered.sort(sortByDate("desc")); const numberOfPages = Math.ceil(sortedPosts.length / maxPostsPerPage); for (let pageNum = 1; pageNum <= numberOfPages; pageNum++) { diff --git a/src/_data/publicRustWorkshops.json b/src/_data/publicRustWorkshops.json new file mode 100644 index 0000000000..681415c421 --- /dev/null +++ b/src/_data/publicRustWorkshops.json @@ -0,0 +1,10 @@ +{ + "workshops": [ + { + "endDate": "2024-05-29T18:00+02:00", + "date": "May 28th + 29th, 2024, 14:00-18:00 CEST", + "text": "Remote Workshop: Telemetry for Rust APIs – you can't fix what you can't see", + "link": "https://ti.to/mainmatter/rust-telemetry-may-2024" + } + ] +} diff --git a/src/services/workshops/rust.njk b/src/services/workshops/rust.njk index 5cf5924341..a266f837da 100644 --- a/src/services/workshops/rust.njk +++ b/src/services/workshops/rust.njk @@ -77,8 +77,8 @@ description: "We provide a number of workshops to enable teams to succeed with R starting from the basics of the language all the way to advanced testing techniques and comprehensive telemetry instrumentation.', workshops) }} -{% set public_workshops = [] %} -{{ publicWorkshops(public_workshops) }} +{% set futurePublicWorkshops = publicRustWorkshops.workshops | future %} +{{ publicWorkshops(futurePublicWorkshops) }}
@@ -238,19 +238,24 @@ description: "We provide a number of workshops to enable teams to succeed with R
-{% - set 'content' = { - "subtitle": "Discover our other services" - } -%} -{{ featuredServices(services['rust-workshops'], content) }} +
+ +
+ +{% include "global/rust-cta.njk" %} {% include "global/rust-newsletter-cta.njk" %} -{% - set 'content' = { - "title": "Grow your business with us", - "text": "Our experts are ready to guide you through your next big move. Let us know how we can help.", - "linkUrl": "/contact", - "linkText": "Get in touch" - } -%} -{{ ctaBanner('purple', 'full', content) }}