It's a plain markdown post. It's a hello world! It's a changelog! Is there anything this post can't do? Well, yes. Quite a lot
2023-12-23
This is a plain markdown post. Also serves as an informal changelog for this project:
layout.liquid
file, some .md
files in a posts
folder, and index.html
file in the root folder to create the index page, and a posts.json
file in the posts folder to ensure that everything in the posts
folder is automatically given a "posts" tag.eleventy.js
configuration file in the project root folder. To get it working you also need to modify the template in the layout.liquid
file so that it loads the PrismJS syntax highlighting JS from your favourite CDN. Once that was complete, code blocks show syntax highlighting but of course they do not execute..kmd
file extension, in which the R code chunks are written using knitr syntax. Eleventy ignores this file, but I can call knitr::knit()
to create a knitted markdown file with the .md
file extension. Eleventy picks up this .md
file and creates the corresponding .html
for the blog_site
folder to .gitignore
for now. I also wanted a README.md
file for github that isn't part of the blog, so now I need to add an .eleventyignore
file (see here) too so that eleventy doesn't try to include the readme in the static site.eleventy.js
filedocs
rather than _site
, and we need to ensure that eleventy ignores the docs
folder. Also need .nojekyll
and CNAME
files with a passthrough so it ends up in the docs
folder, and setup the CNAME resource record for the subdomain knitr-11ty.djnavarro.net so that it deploys correctly. In this instance I'm deploying to the root of a subdomain so I don't have to bother with this but if you're deploying to a subdirectory you need to set a path prefixposts/my-blog-post.md
to _site/posts/my-blog-post/index.html
(or in this case docs
not _site
). That's convenient if the whole blog post is just a single markdown file but it won't work in the knitr context because we need the .kmd
file (knitr markdown), the rendered .md
file, and any images knitr creates to be grouped together. For the images in particular it's important that we preserve the directory structure or else everything breaks. Fortunately this is easy: you just create the desired folder structure and rename the files to "index". So now I have posts/my-blog-post/index.md
as the markdown, and eleventy will also write that to _site/posts/my-blog-post/index.html
..eleventy.js
file to create a rule for png filesrender.sh
shell script that calls knitr::knit()
to render a post from .kmd
to .md
. After a little bit of thought I decided that since (a) eleventy is very fast at rebuilding the website and (b) I've had bad experiences with tools that "automatically" decide when to re-render a source document, it makes sense not to automate the knit process for this toy projecttweaks.css
to override skeleton defaults I didn't want