Blog
Learn how to create, manage, and customize blog posts with multi-language support
MkSaaS includes a powerful blog system built with Content Collections and MDX. The blog system supports multi-language content, categories, authors, and rich content formatting, making it ideal for SaaS marketing, announcements, tutorials, and knowledge base articles.
Blog System Structure
The blog system is built using Content Collections and integrates with internationalization.
Configuration
The blog system can be configured in src/config/website.tsx
:
Blog Collections
MkSaaS uses the following blog-related content collections:
Creating Blog Content
Adding a New Blog Post
- Create a new MDX file in the
content/blog
directory:
- Ensure your author and categories exist in their respective content collections.
Adding a New Author
Create a new MDX file in the content/author
directory:
Adding a New Category
Create a new MDX file in the content/category
directory:
Multi-language Support
MkSaaS blog system fully supports internationalization. You can create content in multiple languages using the following file naming convention:
- Default locale (e.g., English):
filename.mdx
- Other locales (e.g., Chinese):
filename.zh.mdx
Multi-language Blog Post Example
For an English blog post:
For the same post in Chinese:
The system will automatically match the post with the appropriate language based on the user's locale.
Multi-language Authors and Categories
Follow the same pattern for authors and categories:
Customizing the Blog Schema
To add new fields to blog posts, authors, or categories:
- Modify the schema in
content-collections.ts
- Update the transform function as needed
- Update components to display the new fields
Example: Add a "featured" Field
Then, you can use this field in your blog posts:
Advanced Usage
Changing Blog Post Card Layout
Customize the blog card component in src/components/blog/blog-card.tsx
:
Querying Posts Programmatically
You can query posts programmatically using Content Collections:
Best Practices
- Use High-Quality Images: Use properly sized and optimized images for blog posts
- Consistent Categories: Maintain a consistent set of categories across posts
- Strong Meta Content: Write compelling titles and descriptions for SEO benefits
- Structured Content: Use proper headings and sections in your blog post content
- Include Table of Contents: For longer posts, ensure headings are organized for TOC
- International Content: Keep translations consistent across all localized content
- Optimize Images: Use responsive images and lazy loading for better performance
Next Steps
Now that you understand how to work with the blog system in MkSaaS, you might want to explore these related features: