How to Publish a Blog Post on This Website
This guide will walk you through the process of creating and publishing blog posts on this VitePress-based website.
Prerequisites
Before you start writing, make sure you have:
- Node.js installed on your system
- Git for version control
- Basic knowledge of Markdown syntax
- Access to the repository
Setting Up Your Development Environment
1. Clone the Repository
git clone https://github.com/IsaacHuo/My_Blog.git
cd My_Blog2. Install Dependencies
npm install3. Start the Development Server
npm run devThis will start a local development server at http://localhost:5173/My_Blog/
Creating a New Blog Post
1. Choose the Right Directory
- For English posts:
en/blog/ - For Chinese posts:
zh/blog/
2. Create Your Markdown File
Create a new .md file in the appropriate directory. Use a descriptive filename like my-awesome-post.md.
3. Add Frontmatter
Every blog post must start with frontmatter that defines metadata:
---
layout: ArticleLayout
title: Your Post Title
date: 2024-01-25
author: Isaac Huo
tags:
- Tag1
- Tag2
- Tag3
description: A brief description of your post
---Frontmatter Fields Explained
- layout: Always use
ArticleLayoutfor blog posts - title: The title of your blog post
- date: Publication date in YYYY-MM-DD format
- author: Your name
- tags: An array of relevant tags
- description: A brief summary for SEO and previews
4. Write Your Content
After the frontmatter, write your content using Markdown syntax:
# Main Heading
Your introduction paragraph goes here.
## Section Heading
### Subsection
Content with **bold text**, *italic text*, and `code snippets`.
```javascript
// Code blocks are supported
function example() {
console.log("Hello, world!");
}- Bullet points
- Are supported
- As well
- Numbered lists
- Work too
- Perfectly
Blockquotes are great for highlighting important information.
## Markdown Features Supported
### Code Highlighting
Use triple backticks with language specification:
```javascript
const greeting = "Hello, world!";
console.log(greeting);Tables
| Feature | Supported |
|---|---|
| Tables | ✅ |
| Links | ✅ |
| Images | ✅ |
Images
Place images in the public/ directory and reference them like:
Links
- Internal links:
[About](/en/about) - External links:
[GitHub](https://github.com)
Table of Contents
The ArticleLayout automatically generates a table of contents from your headings. Use proper heading hierarchy (h1, h2, h3, h4) for best results.
Preview Your Post
While the development server is running, you can preview your post by navigating to:
http://localhost:5173/My_Blog/en/blog/your-filename.htmlhttp://localhost:5173/My_Blog/zh/blog/your-filename.html
Publishing Process
1. Test Locally
Always test your post locally before publishing:
npm run build
npm run preview2. Commit Your Changes
git add .
git commit -m "Add new blog post: Your Post Title"3. Push to Repository
git push origin main4. Deploy
If using GitHub Pages or similar hosting, the site will automatically rebuild and deploy your changes.
Best Practices
Writing Tips
- Clear Headlines: Use descriptive, engaging titles
- Proper Structure: Organize content with headings and subheadings
- Code Examples: Include practical examples when discussing technical topics
- Consistent Style: Follow the site's tone and formatting conventions
SEO Considerations
- Meaningful URLs: Use descriptive filenames
- Meta Descriptions: Write compelling descriptions
- Tags: Use relevant, specific tags
- Internal Linking: Link to related posts when appropriate
Technical Guidelines
- File Naming: Use lowercase, hyphen-separated names
- Image Optimization: Compress images before uploading
- Performance: Keep posts reasonably sized
- Mobile-Friendly: Test on different screen sizes
Troubleshooting
Common Issues
Build Errors
- Check your frontmatter syntax
- Ensure all quotes are properly closed
- Verify image paths are correct
Styling Issues
- Make sure you're using
ArticleLayout - Check that headings follow proper hierarchy
Navigation Problems
- Verify your file is in the correct directory
- Check that the filename is valid
Getting Help
If you encounter issues:
- Check the console for error messages
- Review the VitePress documentation
- Examine existing posts for reference
- Contact the site administrator
Conclusion
Publishing on this blog is straightforward once you understand the workflow. The combination of VitePress and Markdown makes it easy to create professional-looking, well-structured blog posts.
Remember to:
- Test locally before publishing
- Use meaningful tags and descriptions
- Follow the established conventions
- Keep your content engaging and valuable
Happy blogging! 📝