Add a New Post
Adding new posts is essential to keeping your site updated with fresh content. Follow these steps to create and publish a new post in Try-O-Theme.
Step 1: Navigate to the Posts Directory
- Open your project directory.
- Go to the src/contents/posts/ folder. This folder contains all post-related content.
Step 2: Create a New Post Directory
- Create a new directory for your post:
- Name the folder based on the post title or a short identifier. For example:
mkdir src/contents/posts/my-first-post
- Use lowercase letters and hyphens to maintain consistency in folder naming.
- Name the folder based on the post title or a short identifier. For example:
Step 3: Add an index.md File
- Inside the new directory (e.g., src/contents/posts/my-first-post), create a file named index.md.
- This file stores the metadata and content for the post.
- Add the following content to the index.md file:
Fields Explanation:--- type: post title: "My First Blog Post" description: "This is an introduction to my first post." publication: 2023-01-26 10:00:00 tags: - tech - tutorials authors: - john-doe featured: true ---
- type: Always set to post.
- title: The title of the post as it will appear on the site.
- description: A brief description or summary of the post.
- publication: Specifies the publication date in the YYYY-MM-DD HH:MM:SS format.
- tags: A list of tags associated with the post.
- authors: A list of authors who contributed to the post.
- featured: Set to true if the post should appear in the featured section of the homepage.
Step 4: Write the Post Content
- Below the metadata in index.md, write the full content of your post using Markdown. Example:
---
type: post
title: "My First Blog Post"
description: "This is an introduction to my first post."
publication: 2023-01-26 10:00:00
tags:
- tech
- tutorials
authors:
- john-doe
featured: true
---
## Welcome to My First Post
This is the content of my first blog post. It’s written in Markdown, so you can easily format headings, lists, images, and more.
### Here’s a List
- Item 1
- Item 2
- Item 3
Step 5: Add a Cover Image
- Your new post requires a cover image, create an assets folder inside the post directory:
mkdir src/contents/posts/my-first-post/assets
- Copy your cover image to the assets folder:
- The filename should be cover.* (e.g., cover.jpg, cover.png, cover.webp).
- If there is a cover.* image in the assets folder, Toucan will automatically use it as the post’s cover image, and it will be displayed in the lists.
Step 6: Add Images (Optional)
- If your post needs to include other images, create an assets folder inside the post directory (if not already exist):
mkdir src/contents/posts/my-first-post/assets
- Place your images in the assets folder and reference them in your Markdown content. Example:

Step 6: Regenerate the Site
Once the post is created, regenerate your site to apply the changes:
- Open your terminal and navigate to your project directory.
- Run the following command:
toucan generate
- This updates the site’s content and templates to reflect the new post.
Step 7: Verify the Post
- Start the local development server:
toucan serve
- Open your browser and go to http://localhost:3000.
- Go to the Posts page or homepage to verify that the new post is displayed.
Additional Notes
- Editing Metadata:
- You can edit the index.md file at any time to update the post’s metadata or content.
- Featured Posts:
- To feature a post, ensure the featured field in the metadata is set to true.
This guide ensures you can easily create and manage posts in Try-O-Theme.