Skip to main content

Hugo Archetypes

·204 words·1 min

Info

This post was imported from a personal note. It may contain inside jokes, streams of consciousness, errors, and other nonsense.

I tried creating a new markdown file in Hugo to start using for my devlog but I ended up working on a Python script to automate creating the directory and a template. So here I am writing in Obsidian for now but I’ll copy this over later.

Hugo Archetypes

Hugo does have a templating mechanism for new content called ‘archetypes.’ It can create a new page for me, even a page bundle, but I’d have to manually figure out the timestamp for the folder name.

Maybe the naming scheme using timestamps is completely unnecessary. That came from the Blowfish theme’s content generator. I could just give the folder names a date and avoid having to title the document until after I’d finished adding notes to it. Much easier than predicting how a particular day of development goes.

I’m out of time for now but for next time:

  • Write a Python script to rename the files in content/devlog to be just YYYY-MM-DD
  • See if I can just use hugo new content content/devlog/YYYY-MM-DD/index.md to generate a new entry.
  • Make a one-liner that figures out the date automagically.