Creating Tag Archives
Tags took me so long to figure out. It stumped me for a long time. I thought it should be fairly simple. It turns out, it was my code that needed refactoring. There were two discoveries that I needed to make to understand what went wrong
A Tag Archive
Per usual, it started with a Google Search. I found this article by Nicholas C. Zakas. It discusses how to make a Jekyll-style archive by year. This wasn’t quite what I was looking for but it worked.
This adds tagged blog posts to their own archive without pagination. There would be no pages to make browsing the website easier. I wanted to match my blog with six posts per page.
Adding Pagination
Sometimes, I stroll through the free themes for Astro. This helps me understand it more. Looking at other people’s code is helpful.
I was looking at the Astro Ink theme. There is a link there to a blog by Aftab Alam, the creator, who wrote about building data-driven pages.
This whole article is about creating Tag archives in Astro! I finally understood what I needed to do to make it work. Finding the right tutorial changes your world.
The Takeaway
You need to look at what other front-end devs are doing. There are people out there who are making videos and articles about Astro. We are up to Astro 3.0 now and the team keeps adding in new features. Learning is a never-ending process.