Blogs are an essential part of most modern websites. GeniePy makes it easy for you to write one for yours using Markdown.

All you need to do is to start writing the content, no configuration required.

Content

The application looks for blog content inside the app/contents/blog/ directory.

Each Markdown file present in this directory is loaded and parsed to extract a blog post. Files in this directory can have the .md or .markdown extension and should contain content formatted as follows:

---
title: This is the first blog post ever!
slug: first-blog-post-ever
date: 2023-01-01
tags: demo, tutorial
description: With this blog post we would like to show that you can easily create blog posts using the Markdown format.
---

# Heading

The content can be **bold** or *italic*.

## Subheading

Lists can be added as follows:

- first
- second
- third

You may recognize that this is Markdown with some frontmatter in the beginning, similar to how Jekyll formats blog posts. This simple format lets you write blog posts and also lets you attach metadata to these posts with the least amount of friction, letting you provide the maximum value to your end-users.

The metadata defined at the beginning of a post should be in the form of frontmatter key/value pairs. The following keys are supported:

  1. title: the title of the blog post
  2. slug: the slug that you would like this blog post to have in the URL
  3. date: publication date of this blog post
  4. tags: a comma-separated list of strings, each of which will be added as a tag to the blog post and also to the post's meta tags for SEO
  5. description: a short summary of the blog post, which will primarily be used as the meta description on the blog post's page to boost on-page SEO

After the frontmatter, the main content of the blog post is written in plain Markdown. The Markdown format makes it easy to write text that can be easily understood by both humans as well as computers.

Code

The app.services.blog service is responsible for performing the main heavy-lifting when it comes to loading blog posts.

The service provides two main entry points - get_posts() and get_post(slug). The first function returns all the blog posts and the second one returns a single blog post identified by the given slug.

One layer below these functions is where the app.services.blog.BlogDB class operates. This class is instantiated once and the resulting object is responsible for loading and parsing blog post from the files on disk.

Note that during the normal day-to-day work you likely wouldn't have to work at this level. Regardless, it helps if you know how this is all built.

SEO

We all know it for a fact that SEO is important. This is why all the blog post pages rendered by GeniePy automatically contain the commonly used SEO tags without you having to make any extra effort.

Automatically attached meta tags include the meta description, Twitter card tags, and Open Graph tags. The last two types of tags make your blog post particularly stand out on social media platforms including Twitter, Facebook, and LinkedIn.