"You just won't believe how vastly, hugely, mind-bogglingly big it is."

filed under:

2015-10-02 Yance Man

I was recently in need of a decent resume site. Ideally, it would be something that was easy to update, and which was able to automatically produce both an HTML/web version and a printable PDF without duplication of effort. I thought for sure that there would be something simple and bulletproof out there already for exactly this purpose. If there is, please let me know, but I wasn't able to find any purpose-built software that I was happy with.
Then I realized that this was a perfect job for Jekyll, the very nice Ruby-based static website generator that I use for this very blog. That would take care of one piece, the transformation of simple (YAML) data files into a manageable static website through templating. But how would I automatically generate the PDF resume? I didn't want to update things in two places every time I made a change, for example by maintaining a parallel LibreOffice document alongside the website.
That's when I reached for wkhtmltopdf a handy little utility that uses the WebKit rendering engine (the heart of the Safari, Chrome, and Opera browsers) to produce a PDF document from an HTML page. Now, I can create a special HTML/CSS template, have Jekyll turn the YAML data into both a website and an wkhtmltopdf-ready page, generate the PDF from that, and serve the whole thing statically.
+-----------+ +-----------+ +------------+ | | | | | | | YAML & +-------->| HTML |-------------->| PDF | | templates | jekyll | pages | wkhtmltopdf | | | | | | | | +-----------+ +-----------+ +------------+
Now a single addition to any of my credentials, jobs, or projects and a simple rebuild would result in a new static site (e.g., along wth the corresponding PDF resume for emailing, uploading to HR systems, and so on. (e.g.
The addition of a third-party tool somewhat complicated my usual Jekyll deploy methodology, since a jekyll build by itself wouldn't be enough to generate the whole site. There are ways to create plugins and incorporate third-party tools into Jekyll, but I opted for a much simpler approach and just used make. Here's the simple Makefile used to build the site and PDF, removing the intermediate HTML document as it is no longer necessary:
site: _site/resume.pdf _site/resume.pdf: _site/resume.html xvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf \ -s letter \ -B 1.5in -L 0.5in -R 0.5in -T 0.5in \ _site/resume.html _site/resume.pdf; \ chmod 644 _site/resume.pdf; \ rm _site/resume.html _site/resume.html: jekyll build
Since this feels like something others might want to use, I removed all references to myself and hid them in the Jekyll ./_config.yml file. In theory, all you should need to do to clone should be to clone the yance-man repo, change the values in ./_config.yml to your liking, add your own entries in ./_jobs, ./_credentials, and ./_projects, and then let things rip with make. The static HTML files will show up in ./_site. I hedge that with "in theory" only because I know you'll want to tweak things to your own liking by messing with the Jekyll templates.
If you find this helpful, please drop me a line and let me know.