1 hour ago · Tech · hide · 0 comments

Earlier today, I wanted to link to a specific year of posts on my Coffee category page. Importantly, all of my posts in a category are listed on a single page. I do this because I like having an overview of all posts on a single page. And, by having all post tiles on one page, I can search for keywords on the page, which I do quite often.This gave me an idea: I could add HTML IDs to the page that let me link to the most recently published post on each day, month, and year?I came up with the following URL structure:/coffee#2021 would link to the most recent post published in 2021./coffee#2021-04 would link to the most recent post published in April 2021./coffee#2021-04-02 would link to the most recent post published on April 2nd, 2021.Here's an example link that points to the most recent post published in 2021 in my Coffee category.To make this work, the li elements in the list now have anchors. If an item is the most recent post in the year, it has the anchor equal to the year. The…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.