js page index
This site is built with my modified version of Zonelots, which is a structure for sites built around a JavaScript code that deals with an array of posts, complete with tags and dates and all.
I enjoy this immensely. However, I also have some things that don't quite fit into the blog post style. In particular, I really didn't want my shrines to be dated, since I go back and add things as needed, so any date would quickly become inaccurate.
So I took the indexing capabilities of the foundational Zonelots script and modified it to make a mini-index. Or, rather, mini-indicies: a very, very bare-bones script for my shrines and a slightly more complex one for my recipes, which maintains tagging abilities. The code below is for the latter; if you want the simpler version, just delete the marked sections.
instructions
A few notes:
- This is dependent on some of the CSS classes established in Zonelets. I've included the code below for the
post-title
,index
, andtag-list
classes.[1] - If you are running this script on a page that already uses Zonelets or a script based on its script, you will need to ensure that your variables have different names, or your browser will throw all sorts of fun errors. In the example below, which is taken from my recipes page, I have left in all my variable names, which tend to be the names from Zonelots with "recipe" in place of "post" or otherwise appended to the name. If you're doing something other than recipes (and also care), it should be easy enough to do a find/replace for "recipe"; likewise, you should replace "recipe" in the subsequent instructions.
- You'll probably need to edit some of the links, depending on where you're placing the script and the files it's meant to organize. If you plan to use a similar structure to mine (a directory, in this case
/pages/recipes/
, containing the script_recipes.js
and all relevant HTML files), then the only thing you should need to change is theconst recipePath
. - And speaking of files, you'll need an index page featuring the line
<ol id="recipe-index" class="index"></ol>
and if you're using tags, you'll also need a tags page featuring the line<ol id="recipe-tags" class="index"></ol>
. Both will need to call the script[2] .
code
JavaScript
CSS
- I also use my "box" class, which is just a transparent background with rounded corners, but I've removed that from the code below.^
- Because of the way I've set this up (with no inherent order and thus no navigation between pages), you don't need to call this script on every page it organizes, unlike in the case of Zonelets et al., only on the index page and, if applicable, the tags page.^
- tags
- projects