Micro Blog
It’s been a while since putting together a personal
The project’s name is canory, and no it’s not a play on the
domestic canary. It’s the
result of a
GPT
(Generative Pre–trained Transformer) this word does not
exist generator.
Pure Static HTML
HTML
is powerful and getting much more so. This micro blog is compiled to pure
HTML
. The only build steps involve running hugo
and copying html
files to
a place where the almighty index.html
is understood. That could be a server,
content delivery network (CDN
), or whatever floats your boat. If you want to
explore the full powers of HTML
in all of its glory check out the
MDN
(Mozilla Developer Network) Web Docs
— it’s the
HTML
specification is the
final source of truth, but you get the idea.
HTML
hands down.
Semantic Pact
The markup consists of semantic tags, custom elements and no classes. Solo
maintaining, and handcrafting CSS
(Cascading Style Sheets) is
much easier this way. Further application of this approach ventures into the
realm of
web components,
but only custom elements are written, without using any of the
JavaScript
APIs
(Application Programming Interface) or
splitting similar constructions into components. The semantic pact is my
jargon for this approach.
Content Security Policy
Embedding is CSP
) allow restricting what can happen on a web page with a fine degree of
accuracy.
Usually my content policies are driven from a server configuration with headers,
but since this theme has to be as pure and as batteries included as possible,
policies are better written using <meta>
tags. Many fine folks
already do this
with hugo
. All inline scripts have been disabled, but disabling inline
CSS
conclusively will take a bit more cleverness.
Deno and JavaScript
This runs nicely without
JavaScript
, and you
probably won’t even notice the difference, but there are some
progressive enhancements
using standard JavaScript
. Deno is the secret sauce
and a very JavaScript
“strategically”. No more package.json
,
node-modules
, or other cumbersome solutions to business problems technologists
love to come up with.
npm
ecosystem
and creating a dynamic website. Inside the box, there’s optional
TypeScript
, bundling, executable compilation,
remote imports
and more, all for free, and in one executable — deno
. Deno for now soft
harnesses bundling a few JavaScript
progressive enhancements, nothing especially
fancy.
Fetching Remote Data
In my previous article, there’s no mention of Hugo’s
remote data fetching
ability, and that’s because my tendency is to write about things only after
trying it out completely. Remote data fetching is a very powerful feature,
allowing one to collect dynamic data into the application at compile time and
cache that data. Right now, the micro blog can fetch RSS
(Really Simple Syndication) feeds (hacky)
at build time. Hugo can fetch a wide array of data types including JSON
(JavaScript Object Notation), CSV
(Comma Separated Values), and
XML
(Extensible Markup Language).
Current Limitations of Hugo
Hugo is about 80~90%
complete by my estimation, at least for my imagined
purposes. This theme uses pretty much every feature of hugo
and has brushed up
against some limitations.
Error Handling Generality: Remote data fetching is a lightning rod for failure. At the moment, many types of data fetching errors cannot be handled, so compilation can fall down in varied situations. Fortunately the upstream developers appear to be solving this limitation.
Page Data Structure: It would be nice to programmatically instantiate a page
without Markdown
(page resources may
already allow
this by pre–generating markdown
). The page data structure is still sort of a
mystery and maybe this is already possible — that’s an investigation for
another time. Instantiating a post would allow weaving external data into the
page map. My theory is that, you’d need to rebuild the page structure manually
first to weave in your own data (for example multiple instances of micro blogs
connecting to each other in a cohesive way).
Pagination Generality: In terms of pagination, the separation of taxonomy
and term
was a nice surprise when making this micro blog — it ultimately
means that my main blog can be vastly simplified. What would be great is if
hugo
could paginate relative to any layout position, but this is probably outside of the
scope of hugo's
purpose.
Conclusion
There you have it — a quick overview of some technical details of note that arose when crafting this theme. Now the fun of micro blogging begins.