Blaugust 2022 - Moving from WordPress to HTML – Using Templates
Posted on August 5, 2022 by Aywren
The biggest tool I’ve used in making a move from WordPress.com to static HTML are hand-coded templates. When I say templates, I don’t mean the themes that you download for a WordPress site, though it is somewhat similar.
In the previous post, I talked about the Simply Static export I used to pull the raw HTML code from what used to be a WordPress.com blog. However, this HTML was missing proper styling, which means it just looks like a bunch of mumbo-jumbo on a page.
In order to make it look something like this…
…I create HTML templates for my blog pages. These are like a shell of code that fits snuggly around the blog post HTML I exported to provide it structure.
This structure tells the blog post that it needs to look like the rest of the website. And if coded properly, the mish-mash export then turns into a proper blog post page!
A Look at My Templates
I build and use templates for all content that I know I’m going to make repeatedly. Not only does this save time – I don’t have to recode every page from scratch! – but it also ensures that each page is consistent with each other. They’re all using the same banner at the top, the same sidebar information, the same footer – that sort of thing.
Here’s a sample of some of my template files.
Because I need to add pages for each new blogging month, _blogmonthtemplate is the code I use for a foundation for each new month HTML file.
Every time I write a new post, I crack open _newblogpost, copy that code, and drop it in my new post HTML file so that every post has the same look and layout.
If I need to just make a standard page that’s not a part of the blog, _template is the template code to use!
It may seem strange to have a second template for blog posts, but _templateblogpost is code used to create the foundation for an old blog post that was imported from WordPress.com. Those require slightly different code than a brand new blog post, so they have their own template.
If I were to open up one of these template pages, this is what you’d see:
Basically, it’s just a blank placeholder page waiting for me to insert the actual blog content into it. I’ll talk more about my post creation process next time, and maybe it will make more sense then!