The “On This Day” page use to pull in a manually written loop of each year the site’s been around, which had a few problems:
- remembering to manually update that loop every year was difficult for me.
- it was showing only the featured image and not all the attachments, so you were missing out on some quality images if you didn’t click through
- the images were all squished into a same sized 145 pixel box which looked like utter shit.
- as of 2018 there were 260 images loading on every page load, that’s a huge resource hog!
I’ve fixed this by making it a dynamic loop of all the years for the posts, showing all the attachments and using some js magic to get the images to make a beautiful wall of images, then using that dynamic loop to spit out just the year you’ve selected to the page instead of all 200+ images at once.
This does a couple cool things, most notably makes it all dynamic so I don’t have to touch this again when 2019 comes through and make it look cool as fuck when you resize the window. It also takes a significant bit of load from the server.
Speaking of the server, it should be much peppier now that I’ve increased some memory pools to be 10gigs and not 1 gig. I’m going to monitor and see if I can increase it to 20 gigs, but I want to be sure that everything is stable before I start blowing up the memory like that.
And finally speaking of blowing things up, the related images have returned! Let’s see if I can keep them around for longer than a week this time!
“…using some js magic…”
Brace yourselves…
luckily it’s the same thing i’ve had on the archive pages for the last 6 or 7 months and it’s been relatively robust.