From ae41975b44ff7b23bc3fe94e086869e5d71cdc88 Mon Sep 17 00:00:00 2001 From: Roman Kashitsyn Date: Thu, 18 Jan 2024 23:01:56 +0100 Subject: [PATCH] fix(posts): render subtitle as meta description --- Makefile | 21 +++++++++++++++++++++ README.md | 5 ++--- blogware/layout.go | 1 + post.tmpl | 4 ++-- posts/13-icp-ledger.tex | 2 +- 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c843d99 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +PORT ?= 9090 +DEST ?= site + +.PHONY: help +help: + @echo "Supported targets" + @echo "=================" + @echo "serve - serve the blog content on the PORT" + @echo "render - render the website into the DEST directory" + +.PHONY: serve +serve: build + ./blogware/blogware -serve localhost:$(PORT) + +.PHONY: render +render: build + ./blogware/blogware -output $(DEST) + +.PHONY: build +build: + pushd blogware; go build; popd diff --git a/README.md b/README.md index 117ac7d..300bf5e 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,11 @@ This repository contains the full source of my personal blog hosted at https://m # Build instructions -You’ll need [Go](https://go.dev/) installed to build the website. +You’ll need [Go](https://go.dev/) and [Make](https://www.gnu.org/software/make/) installed to build the website. Execute the following commands in the root repository: ```bash -pushd blogware; go build; popd -./blogware/blogware -output site +make render DEST=site ``` The `site` directory will contain the full website contents that you can host statically. diff --git a/blogware/layout.go b/blogware/layout.go index b044ef3..ca4d6cb 100644 --- a/blogware/layout.go +++ b/blogware/layout.go @@ -127,6 +127,7 @@ func renderPostAt(i int, articles []Article) (contents []byte, err error) { ctx := PostRenderContext{ AbsoluteURL: rootURL + article.URL, Title: article.Title, + Subtitle: article.Subtitle, CreatedAt: article.CreatedAt, ModifiedAt: article.ModifiedAt, Keywords: article.Keywords, diff --git a/post.tmpl b/post.tmpl index 6772453..3233830 100644 --- a/post.tmpl +++ b/post.tmpl @@ -6,9 +6,9 @@ - {{ if .Subtitle }} + {{ if .Subtitle -}} - {{ end }} + {{- end }} {{ .Title }} diff --git a/posts/13-icp-ledger.tex b/posts/13-icp-ledger.tex index 43204ff..145f794 100644 --- a/posts/13-icp-ledger.tex +++ b/posts/13-icp-ledger.tex @@ -1,7 +1,7 @@ \documentclass{article} \title{IC internals: the ICP ledger} -\subtitle{The treasury of the Internet Computer utility tokens.} +\subtitle{The design of the Internet Computer utility token treasury.} \date{2022-12-19} \modified{2022-12-19}