It's a well-known fact that personal professional websites often serve as playgrounds and are over-engineered. This website is no exception. Instead of using a straightforward solution like Vercel to host this Next.js site, I chose to host this website on AWS using CDK. I built a server less mail server using AWS CDK, Lambda functions, and Amazon SES for free mail receiving and sending. Additionally, I maintain a single source of truth for my references and skills, which I use to populate both the homepage and CV downloads.
In this post, I'll share insights about the CV generation process, which might interest those who enjoy adding sophisticated features to their projects, or perhaps those who need this functionality for professional applications.
The Starting Point
My references are stored as markdown files in a dedicated folder. I use front matter for metadata (such as dates and company names) and plain text to describe my project experiences. These markdown files are loaded during website build time, sorted by date, and pre-rendered along with the rest of the website.
The Requirements
Recruiters and Project Managers seeking freelancers typically request a .docx
version of your CV. This allows them to mask personally identifiable information and create anonymous profiles which they send to clients. Initially, I considered manually creating these .docx
files in Google Docs and providing them as downloads. However, I discovered docxtemplater
, a library that enables dynamic .docx
file templating with data population – similar to Jinja, but for Word documents. With some time to spare and curiosity driving me, I decided to explore this solution.
The Libraries to Make This Work
The main library I use to dynamically populate docx files is called docxtemplater
- you can read more about it on GitHub. Additionally, I wanted to integrate images into the docx dynamically, which would normally be a paid extension for docxtemplater, but there is also an open-source alternative available here.
The setup is described in detail for both libraries and takes just a few minutes until you can populate the first fields in your docx file.
Creating a Template .docx File
Like other template engines, docxtemplater allows you to use placeholders and special character combinations to include conditions, loops, and other dynamic elements in your CV.
Simple placeholders are surrounded by {{ }}
, which lets you populate them with data. Loops are marked by {{#loop_variable}}
and {{/loop_variable}}
... you get the idea. It's also possible to use loops in combination with tables, which is the most effective layout component to align your content inside the template.
Here is the references section of the template:
Note: The table outline is visible only for better understanding. The actual table is border less and used primarily for layout purposes.
As you can see, the syntax is straightforward:
- The
^
mark is used for conditions - Loop syntax for iterating through data
- Static text where needed
- the image placeholder is starting with a
%
sign
The Result
The resulting populated document looks like this:
I've also extended the template to include my skills as a table, dynamically populated from a YAML file that serves both the website and the template. You can view and download the results on my references page.