Generate Markdown Files in Bulk using PageFactory from a Template


I was experimenting with Programmatic SEO where I needed to generate markdown files in bulk. Earlier I used the Mustache template system to do it but now I discovered that this simple tool called PageFactory easily lets you do the same.

It’s surprisingly simple to use and you can generate any kind of text editable files by using the tool.

In this article, I will explain how to use the tool.

Using PageFactory to generate markdown files in bulk

This has only 3 steps:

  1. Creating the template file
  2. Uploading data in CSV format, and
  3. Downloading the generated markdown files

Before I start explaining the steps, you need to have an account with PageFactory in order to perform the steps.

But please note that the tool is currently in beta but I have got access to it. And, I’m sure after it comes out of the beta, most probably it will be a paid tool.

1. Creating the template file

The concept here is that you need to create a file with all the variables that will be replaced with the data taken from the CSV file.

Column headings of the CSV file act as variables in the template file. You just have to wrap the column headings in double curly braces, for example {{movieName}}, {{Duration}}, etc.

Navigate to the Compose section and here’s what the screen looks like:

Opal Template File Full

In the Name field, just put any name that you can remember and in the File Extension field, simply put md as we are creating markdown files here.

Opal Template File

The full template file I created for my use case looked like the screenshot above.

Now, that the template is ready, it’s time to put together the CSV file.

2. Uploading data in CSV format

I collected my data in a Google Sheets document because that can easily be exported as a CSV document. My data looked like this:

Collecting Data in Google Sheets

You can see that the variables in step #1 are exactly the same as the column headings in this step.

Keep your CSV data file ready and navigate to the Compile section in the PageFactory tool.

Select the template that you created in step #1, enter the column name of what you want your files to be named in the File Name Column field, and choose the CSV file.

Create a file name column in the CSV file from earlier and enter the column name in the File Name Column field in the tool.

In my case, here is what the Compile section screen looked like:

Opal Compile Content

After everything is ready, hit Submit.

Related: Convert Evernote’s .enex to .md (Markdown) Format

3. Downloading the markdown files

Just a few seconds after you hit the Submit button in the previous step, a ZIP file will be downloaded to your system.

Just save the file and unzip the file somewhere on your computer. And if you followed every step properly, the extracted folder should contain all the final markdown files.

You can now publish the markdown files online like I did or do whatever you want with them.

Generated Markdown Files

Here’s the folder on my computer that contains all the generated markdown files.

That’s it.

However, if this method is not working for you. You can follow the method discussed in step #2 of this blog post.

And if you get stuck anywhere, just let me know in the comments below.