NutriScan Blog System
This blog system is built using VitePress and Vue. It uses a code-based approach for managing categories and posts.
Blog Management
The blog is managed directly through code files. No command-line tools are provided for blog management.
Managing Blog Categories
Blog categories are managed directly in the code. To add, edit, or remove categories:
- Open
docs/.vitepress/theme/blog-data.js
- Modify the categories array:
js
export const categories = [
{ id: 'getting-started', name: 'Getting Started' },
{ id: 'nutrition', name: 'Nutrition' },
// Add new categories here
{ id: 'new-category-id', name: 'New Category Name' }
];
Adding a New Category
- Add a new object to the categories array with:
id
: Unique identifier in kebab-case (lowercase with hyphens)name
: Display name for the category
Removing a Category
- Remove the category object from the array
- Check all blog posts to ensure they don't reference the removed category
Managing Blog Posts
The blog posts are managed in two places that must be kept in sync:
- Markdown files in
docs/blog/posts/
- Post metadata in
docs/.vitepress/theme/blog-data.js
Adding a New Post
- Create a new markdown file in
docs/blog/posts/
using the template - Add the post metadata to the
data
array inblog-data.js
- Place any images in
docs/public/images/blog/
Removing a Post
- Remove the markdown file from
docs/blog/posts/
- Remove the corresponding entry from the
data
array inblog-data.js
- Remove any unused images from
docs/public/images/blog/
Important Note
Always ensure that both the markdown file and the data entry exist. The site will have errors if:
- A post is listed in
blog-data.js
but the markdown file doesn't exist - A markdown file exists but isn't registered in
blog-data.js
Blog Post Guidelines
When creating a new blog post:
- Copy the template from
docs/blog/posts/template.md
- Update all placeholder content
- Set categories to use IDs from the
blog-data.js
file - Place images in
docs/public/images/blog/
- Follow SEO best practices for content
Blog Features
- Category filtering
- Responsive design
- SEO optimized
- Image optimization
- Rich metadata for social sharing
Technical Implementation
The blog system consists of several Vue components:
BlogList.vue
: Displays the list of blog posts with filteringBlogPost.vue
: Layout for individual blog postsBlogCategories.vue
: Component for displaying/filtering categories
The data for blog posts and categories is stored in blog-data.js
.