Hello Mike, from the future
This is not really a post from the future, but it is used to solve a problem.
The Problem
On the blog listing, I wanted to show a different number of posts on the first page (8) than the rest of the pages (9). Eleventy, the Static Site Generator I used to build this site, doesn't have a nice way to do this.
The solution
Future Post (aka this one)
I created a post that has a future date, of 1st January 2500.
--- title: 'Future Post that will be removed' date: '2500-01-01' tags: ['Future', 'Eleventy'] description: 'If you are seeing this, … ---
Filter out the future post
In order to do this I check if the posts date is not 1st January 2500.
{% if item.data.date != "2500-01-01" %} code that I want goes here {% endif %}
Set a reminder to update in 2500
As I may want to post an article on 1st January 2500, I have set a calender reminder to fix this hack in the future.
Why 'Hello Mike…'
Well it was my good friend Mike that came up with the original idea for solving this:
I would approach this by having a dummy entry in whatever data you're paginating, either at the start or at the end, which has a property set to say that it should not be displayed. #hack @eleven_ty
Quote Source @PermittedSoc - Twitter
Other articles from the blog
SVG Favicons and Dark Mode
Tutorial on how to use Dark Mode with SVG Favicons
Animating a mobile menu
I created a animated logo and navigation for mobile devices and here I explain how I went about doing this.