Zonelots Fix

Many of you may be aware of the Zonelets blogging framework created by Marina Kittaka, but I was looking around for something like Zonelets with a tagging function.

I found pretty much exactly that in Zonelots!

So, I massaged the code until it looked the way I wanted it to, and I came up with this current setup! Everything worked perfectly in my VSC live preview, so I uploaded everything to Neocities and... none of the Javascript-generated content worked.

I just want to clarify up front- the Zonelots project is archived, and I don't expect the author to have it in working order or to be updating it regardless. I was kind of dumb to go full-tilt on editing it before uploading the default framework to see if it actually works.

However! After some snooping around I found this post by Marina describing a bug she had to fix: Zonelets Missing Title/links Bug (Fix Available!).

I compared the section of code she edited in Zonelets' script.js file with equivalent section in Zonelots, and Zonelots did not appear to be updated.

I found the equivalent code by searching for let currentIndex in Zonelots' script.js file:

and mushed the two together until I came to this:

// To do the following stuff, we want to know where we are in the post array (if we're currently on a post page). let currentIndex = -1; let currentFilename = url.substring(url.lastIndexOf('posts/')); // Depending on the web server settings (Or something?), the browser url may or may not have ".html" at the end. If not, we must add it back in to match the posts array. (12-19-2022 fix) if ( ! currentFilename.endsWith(".html") ) { currentFilename += ".html"; } let i; for (let i = 0; i < postsArray.length; i++) { if (postsArray[i].path === currentFilename) { currentIndex = i; break; } }

It took some me some trial-and-error and, because I don't know Javascript yet (I just mimic syntax and try to infer rules), I don't know the implications of my changes. Everything appears to be working so far though, so I'll roll with it!

* echoing Marina: the exact line numbers will vary and copying comments is optional