Time to roll my own. So long, WordPress!
Blog posts are written in a simplified Markdown format in posts
. These are
later converted into JSON objects that can be rendered as components:
-
First line is the title.
-
Second line is the date and time in
YYYY-MM-DD HH:MM
format. -
This line is a comma-separated list of tags.
-
Body comes afer line containing '---'.
-
Each paragraph is treated as a block of text (double newline break).
-
Images

are converted to<img>
. -
Headings are standard header levels with a space beween hash and text.
-
Links
[desc](url)
are converted to<a>
. -
Lines starting with '- ' are converted to bullet lists using tables.
-
Code highlighting uses Markdown triple backticks followed by the language name.
All posts in posts
are built using their metadata to create component lists
that are rendered on the page, and are placed in assets/rendered
.
./pipeline/build-site.sh
The navigation of months per year is built during tools/buildPosts.js
as
assets/history.json
.
After building, opening index.html
and selecting a year and month will show
all the posts from assets/history.json
referring to their rendered components
which can then be displayed.
The chosen month or post is reflected in the query for permalinking.
Currently deployed as a S3 website from bucket, with a CloudFront distribution serving HTTPS with a ACM certificate. The deployment is done with a combination of Terraform and AWS CLI.
The site is deployed by GitHub actions when a new commit is pushed to the
master
branch.
Alternatively, it can be syncronized and invalidated with an AWS IAM User with S3 and CloudFront permissions allowed:
export AWS_PROFILE=...
./pipeline/deploy.sh
You may need to first install the required terraform
version:
cd terraform
tfswitch
No longer used - posts already imported to be modified instead of the originals
-
Copy xml from WordPress to
assets/export
. -
Run
tools/importWordpressXml.js
to convert to a list of posts inassets/import/posts.json
:
node tools/importWordpressXml.js assets/export/tryworkfinallycode.wordpress.2020-06-13.001.xml
The format of the import is as follows:
[
{
"id": "2",
"title": "Here it is",
"link": "https://ninedof.wordpress.com/2013/03/21/here-it-is/",
"pubDate": "Thu, 21 Mar 2013 15:16:22 +0000",
"postDate": "2013-03-21 15:16:22",
"body": "<p>So I've finally started that blog idea I'd had my eye on for a while ..."
},
...
]
- Run
tools/createWordpressMarkdown.js
to create imported cleaned-up Markdown files, which should be later tidied up into proper posts files (see above). Each file placed inposts/
will have substitutions made to ease the transition.
node tools/createWordpressMarkdown.js
Then, build as usual.