Link Search Menu Expand Document

Creating a Draft post

Every post at Genics Blog starts as a draft. In this section you’ll learn how to create a draft post.

Prerequisites:


The content at genicsblog.com is written in Markdown. This means that you can write your content in plain text and it will be rendered to HTML automatically. Let’s create a draft post in markdown!

Create a new file in _drafts folder

Once you fork the repository, you can start writing your post. For drafts, even editing on the GitHub interface works fine.

Open the _drafts folder in the editor of your choice. To create a new draft, press the Create a new file button on the right hand side.

Create a new file from GitHub GUI

Define a name for the draft file

In the editor, give your file a name. Let’s say you want to create a draft titled How to write a draft, the file name for this post would become: how-to-write-a-draft.md.

Defining a file name for the new file on GitHub GUI

Important:

  • All the alphabets in the file name must be lowercase.
  • All the blank spaces and special characters should be avoided, replace with - to seperate words.
  • File must end in extension .md to specifiy a markdown file.

Add the frontmatter

Genics Blog requires each post/draft to have a frontmatter that defines the title, description, and other metadata. This is declared at the very top of the file within --- quotations.

Note: To ease the process explained below, you can use the frontmatter generator tool and copy the generated content to the top of your file.

To manually generate frontmatter, here’s an example of a minimal valid frontmatter that Genics Blog understands:

---
layout: post
title:  "How to write a draft"
excerpt: "The complete guide you'll need to refer to create mind blowing drafts."
description: "This is shown to the search engines. If undefined, excerpt is used as the description."
image: "A url of the hosted image. Paste the image to a comment box on GitHub issues to generate a link quickly."
hasCode: true
category: coding
tags: ["blogging", "tips"]
author: gouravkhunger
---

Omit any of the variables if you don’t want to use them!

  • layout defines what kind of page it will be (for articles, always keep it post).

  • title is the title of the post that will be shown in bold at the blog.

  • excerpt is a short sentence - a summary of the artilce.

  • image is the image url where the thumbnail of this post is hosted. We do not host images, so you need to drag and drop your preferred thumbnail to the GitHub editor and it will automatically generate a URL for the hosted image.

  • hasCode is a boolean value determining if the article has code blocks/snippets. If your post doens’t require snippets, simply remove this key from the front matter. This is used to load prism.js if the value of this key is true.

  • category defines what topic the post is about. Please use only one category per post.

  • tag defines what smaller topics the post is about. Please use a maximmum of 3 tags per post. Exceptions can be made, contact us in that case.

  • author is the username of the author of the post. It was defined when you made a contributor profile.

Optional Values

Here are some optional values you can define for your post:

---
# Other variables here
original: "https://docs.genicsblog.com/author/writing-the-article"
notice: "**Markdown** is supported in this _one_ so you could do [such things](https://genicsblog.com)!"
---
  • original is used to define the original URL of the post (only applicable if you are cross-posting.)

  • notice is a notice that will be shown at the top of the post. You could add some note about the prerequisites for a tutorial, or any other info you want to show.

Write the content

After you are done with the frontmatter, you can start writing the content of your post below the ---.

Please read the UI Components guide to learn how to add various elements to your post.

Also take a look at other drafts or published posts to take a look at how the content is written.

ALERT!

Please DO NOT edit any file outside the drafts folder while you are writing your draft, and DO NOT change with other author’s drafts. This will cause the Pull request checks to fail and delay the review process because of the needed investigation.

Repeated attempts to bypass/hack the CI system will result in a permanent ban from the site, the discord community and will result in deletion of your profile.

Previewing the draft

At this point, you’ll want to preview how the draft would look like on the site.

Once your PR is successfully merged, the draft will appear to a link similar too this:

https://genicsblog.com/draft/how-to-write-a-draft

Replace how-to-write-a-draft with the sluggified name of your file.

A draft is accessible only if someone has its link. This feature is for the authors to preview their posts before they are published and to share with only those whom they want to.

The slug is defined by the name of the file you made. You can preview your changes here, and if needed create new pull requests to change the content of your draft.

Next Steps

Read this guide to get your draft published as a public post!