verdantloom.dev

Building a static site generator

02 August 2024
London, UK

I decided to build a static site generator as a personal project to learn more about the full development workflow from CI/CD to getting more experience with Go as a language.

I’ve started with coming up a list of desirable features for v1, which I’ll run down as I develop them and document lessons learned and attempt to concisely summarise in articles.

V1 Requirements

  • A CLI with build and serve commands.
  • A watch process so that as development progresses the generator will automatically re-build and serve changes.
  • Deployed on AWS to serve as an opportunity to learn more about services and functionality available there.
  • Dynamic rendering of Markdown posts with embedded images as articles.
  • Dynamic rendering of Markdown or JSON as smaller form content/updates.
  • An index page allowing navigation to different pages.
    • Posts (Longer form articles)
    • Updates (shorter form posts)
    • Images (image sets of my own photography and other creative work)
    • Now (what I’m up to now)
    • Uses (what I use)
  • Continuous integration/ Development flow allowing new versions to be deployed with pushes to master on Github.

Questions

  • What is the correct Project Structure for serving both static files like images, and html(structural files such as home, about, articles, etc.) using the same server? i.e. if you’re parking your fileserver at the root, then how would you serve an index/home page at root (the solution to this may include using a ‘serveMux’). If you aren’t using a file server to serve your html pages in the same line of code as your static files like images, how do you assign them as handled routes dynamically? If your static images are stored in a content directory along side your files to be parsed into HTML, what is the best method of programmatically hosting those static files?
    • YOU LEAVE AN INDEX PAGE AT THE PATH/DIRECTORY ELEMENT YOU WANT TO SERVE A PAGE!
  • What is the correct appropriate date time format to use? (I’ve opted for RFC 3339 initially)
  • What language type is appropriate for storing front matter in my markdown?
  • What are the hard and fast requirements and standard practices for formatting HTML documents?
  • Explanation of modes for writing a file, and which cases to use them.
  • What is the best approach for integrating stand-alone tailwind CLI in the build phase of a Go Static Site Generator?
  • Investigate layers in CSS and write a short primer summary weaving in my use case(loading a font family) based on this guide and including clarity on how to import a directory with multiple variations of the same font in separate files. At the same time, Include a note on ensuring font family name matches i.e. Whitespace.
  • Historically, what are the most common layouts for a web-page? What are the benefits of each and how can they be more successfully adapted to take advantage of contemporary design ides? (Holy Grail?). As a follow-up, implementation guidelines with tailwind.
  • What are the benefits and limitations of different line heights and font sizes when declaring a theme for your web-page?
  • What is the most appropriate scripting language for smaller form content? I’m using TOML as I’ve seen that pattern elsewhere and it makes sense that you should load a single document containing all your content when that content in a more abstracted structure would be small, however there is an issue where that document may become bloated over time, this can be remedied with arbitrary separation for example by year.