Emacs Blogging: Insert Tag from YAML Frontmatter Posts

My blog posts here usually have a line like: For tags I don’t use a lot, I sometimes don’t remember how to write them. So I do the only sane thing – and go to my website’s list of tags and look for a match. Got annoyed by that now after a couple of years :)
Adding a Wiki to the Site
Some things on the blog are supposed to have a longer shelf-life. But the nature of a blog is to present things in a timeline. I employ cross-links from older posts to newer posts to encourage exploration with the introduction of the “linked posts” part at the bottom of each post. And I have a structured overview to help with discovery. Even then I branched out into other topical pages, like the TextKit overview, or the even larger FastSpring/Distribute outside the MAS page. To make sense of the timeline, I introduce what’s basically a ‘garden’ to my ‘stream’. It’s not a new idea, but I find not having these overview pages to hamper my writing. Some things need systematic overviews, and I enjoy making these, but there’s no good place for them.
How to Add Backlinks in Nanoc Static Site Generator
Since I’ve added backlinks to the bottom of posts today, I figured I might as well share the code. I’m using static site generator nanoc. It has a preprocessing section in the compilation step where you can add new items and modify items that are read from disk further. I got the basis for this code from Denis Defreyne, creator of nanoc. (Check out his code.)
MultiMarkdown Filter for nanoc
I recently dropped blog posts rendered via MultiMarkdown. I used MMD to support citations, but this is not a book, this is a website! So I retired my MultiMarkdown processor for nanoc, the static site generator that I use. If you need something like it for your project, here it is:
Nanoc3 Boilerplate
I put my personal nanoc boilerplate setup on GitHub. Maybe you find the deployment process useful.
Deployment Process
I assume you’re public html folder is called htdocs/
and you can create new folders below your domains folder but outside htdocs/
.
I also assume you use my Rakefile: upon rake build
it will checkout the branch ‘deploy’ and put all files from output/
in there. Uploading from ‘deploy’ to the production server will only copy the HTML output, not the nanoc setup.
-
Initialize bare production git repository on the server:
git init --bare ~/doms/example.com/git
-
You’ll want automatic updates when you push to the server. Use git’s own
post-receive
hook:# add to ~/doms/example.com/git/hooks/post-receive echo "Updating website ..." cd /the/full/path/to/doms/example.com/htdocs || exit unset GIT_DIR git pull origin echo "Update complete."
Make it executable:
chmod +x post-receive
-
Initialize git repository in
htdocs/
. This will point to the bare
repository on the server and check out the current version:# given you're in ~/doms/example.com/htdocs git init git remote add origin ../git # setup branch to pull from: git config branch.master.remote origin git config branch.master.merge refs/heads/deploy
-
Setup production server locally:
git remote add production ssh://user@example.com/~/doms/example.com/git/ git remote show production
-
Commit changes locally and put them on the server:
git commit rake build git push production deploy
You can push all branches via
git push production
to backup your code.
Only the branch ‘deploy’ will be visible to the public.
Sources
I once combed this together from various sources: