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.
The application looks for blog content inside the
Each Markdown file present in this directory is loaded and parsed to extract a
blog post. Files in this directory can have the
and should contain content formatted as follows:
--- title: This is the first blog post ever! slug: first-blog-post-ever date: 2022-01-01 tags: first, demo description: This blog post intends to demo 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:
- title: the title of the blog post
- slug: the slug that you would like this blog post to have in the URL
- date: publication date of this blog post
- tags: a comma-separated list of strings, each of which will be added as a tag to the blog post
- 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 equally easily understood by both humans as well as computers.
The code for rendering blog pages is split into two logical units: the service code and the HTTP endpoints.
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 -
The first function returns all the blog posts and the second one returns a
single blog post identified by the given
One layer below these functions is where the
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.
Rendering blog pages is handled by the
These two endpoints are fairly straight-forward and very thin. All they do is
app.services.blog.get_post(slug) functions to load blog post and render the
final result as an HTML response for the user.
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.