DEV Community

loading...
Cover image for Keep your posts consistent with a template.

Keep your posts consistent with a template.

Ben Sinclair
I've been a professional C, Perl, PHP and Python developer. I'm an ex-sysadmin. Back in the day, I had a geekcode which I'm not going to share with you. 418 I'm a teapot.
・2 min read

If you find yourself writing posts here a lot, you might find yourself struggling to keep a consistent structure.

I mean, you may not want a consistent structure. Your output might be stream-of-consciousness good-time banter, and that's fine.
But if you're making posts as part of a series1 or if you have a couple of different streams going - maybe a personal blog post vs. a tutorial - then you could do with templating it.

DEV doesn't explicitly support templates, but since you can leave a post in draft status indefinitely, it's straightforward to emulate.

  1. Make a new post, give it an easy-to-locate title like [TEMPLATE: blog posts].
  2. Find one of your posts that's in a style you like and copy the content to your new post.
  3. Rip all the good stuff out of it and replace it with obvious placeholder text.
  4. Save it.

When it comes time to make a new post, copy and paste your template and away you go!

Here's an example, including a few bits to remind me to use numbered bullets if I'm going to refer to something again later, and a common-ish signature2.

--------
title: <TITLE>
published: false
description: <BRIEF DESCRIPTION> 
tags: <TAGS: up to four comma-separated tags, without the hash>
cover_image: <URL: find something on unsplash>
--------

## <SUB-TITLE>

<BRIEF DESCRIPTION>

## <SECTION HEADING>

1. <LIST ITEM>
1. <LIST ITEM>
1. <LIST ITEM...>

## Further reading

This was originally posted on [my personal blog](<ORIGINAL BLOG URL>).

If you're interested, I post about <THIS SUBJECT> a lot on [my Twitter](<TWITTER LINK>)

--------
Cover image credit: <ADD ME: unsplash user> on [Unsplash](https://unsplash.com).
Enter fullscreen mode Exit fullscreen mode

It might seem that this isn't going to save you much time. Well, it might not, for you, but depending on how you post it might help a lot. Who am I to guess?

Cover photo by Francisco Arnela on Unsplash


  1. Did you know you could do that? You add a series name to your front matter and it's done by magic. You can find out more in the editor guide 

  2. I don't really recommend - or like - post signatures, but I wanted an example of something that would stay consistent across posts and it's what I came up with at the time. 

Discussion (1)

Collapse
michaeltharrington profile image
Michael Tharrington (he/him)

I love this! Really clever workaround... also, makes me think we should have a product feature for templates. We do have this somewhat internally and can turn it on for various tags... for instance, if you go to #shecoded and click on write a post in the lefthand sidebar it opens up a template we created... would be cool to extend this feature to DEV users for personal use.