Creating Post
Create post
Setup
05/16/2020
Posts directory
- To create a post with gatsby-blog-mdx, create
*.mdx
or*.mdx
file under_posts
directory
Feel free to choose either *.md
or *.mdx
as both extensions supports markdown and jsx (react component)
.├── _assets├── _posts └── ...
- You can create any directory under posts. For example:
├── _posts| ├──2020| | ├── first-post.mdx| | └── second-post.mdx| └── about.mdx└── ...
Above two posts will automatically have their own directory available at:
yoursite.com/2020/first-post
yoursite.com/2020/second-post
Post description
---title: First Postdate: 2020-03-10draft: false # Optionaltags: [category1, category2] # Optionalexcerpt: "This is my first post" # Optional---
# Fist post
This is my first post
date: format is
YYYY-MM-DD
- [Optional]: You can add time such as
YYYY-MM-DD HH:MM:SS
. Time won't be shown in post, but it may be useful when ordering multiple posts written in the same day. i.e. post with date:2020-03-10 00:00:01
will be displayed before/under one with2020-03-10 00:00:02
- [Optional]: You can add time such as
draft: optional. But when it is set to
draft: true
, it won't be displayed in home page, though it will still be accessible by navigating to post's urltag: when not specified, it will be displayed under Uncategorized tag
excerpt: when not specified, part of your post will be displayed in main page
For example, first-post has excerpt specified while second-post doesn't
MDX---title: "Second Post"date: 2020-02-28---## Second postThis post does not have excerpt specified,thus it will show whatever content that you have in post in home pageMDX---title: "First Post"date: 2020-02-27excerpt: "This post has excerpt specified"---## First PostIn main page, these posts will be displayed like this
About page
About page is available when viewer clicks your name (author name)
.├── _posts| ├── 2020| | └── ...| └── about.mdx └── ...
about.mdx
is located in _posts/
directory. You can modify this file just like how you'd create a post.
Don't like to have about page? Simply disable it in customize.js