🏗 SEP 26: Make page/site metadata accessible from HTML

Status: Initial Implementation 

Date: 2023-04-15
Commit: 2ee7f1c67275c30b9d8674c6f655144baf74e209 
Initial Implementation

Currently if I want to get the UUID for a document, or any other metadata I need to go to the document source itself. But often when I’m making references between documents or running tests on the site etc I’ll be looking at the testing or live version of the site in its rendered form. Being able to access all these variable in that context, and quickly, would be very handy — for debugging purposes, or to quickly grab a UUID for referencing, or to see at which template a document was filtered through.

Implementation

As I see it there are two primary options for exposing this data:

  1. Within the rendered document itself. (perhaps concealed within HTML <detail> element, or in a comment in the markup (would require using ‘view-source’ in a browser)

  2. At a separate but known URL Could be accessed for example by appending /meta to any document URL eg: https://silasjelley.com/design/meta

For now I favour #1 as the implementation would simpler, more reasonable, and would not require the emission of a ‘sidecar’ document to accompany every.

Actually, thinking about this more, I feel like a middle road would actually be the most suitable. A small link, probably in the footer element of each document, that points to a complete plaintext version of the document at one of the below paths:

https://silasjelley.com/design/meta
https://silasjelley.com/design/text
https://silasjelley.com/design/txt
https://silasjelley.com/design.txt

This plaintext version would not simply be the source file for the document, it would be emitted during the build, fully populated with all the additional metadata that is injected in the various processing functions, eg: backlinks, wordcount, etc etc.

I like this solution!

But initially I think I will implement it within the emitted document, and make it accessible by clicking on the publication time at the bottom of the document.