A modern, responsive blog built with Nuxt 3, featuring dark/light theme support, smooth animations, and a clean design.
- π Modern Stack: Built with Nuxt 3, Vue 3, and TypeScript
- π¨ Responsive Design: Mobile-first approach with UnoCSS
- π Dark/Light Theme: Automatic theme switching with smooth transitions
- βοΈ Content Management: Markdown-based blog posts with Nuxt Content
- π Animations: Beautiful animations using VueUse Motion
- π± Progressive: Optimized for performance and SEO
- π― Type Safe: Full TypeScript support throughout the project
- Framework: Nuxt 3
- Frontend: Vue 3 with Composition API
- Styling: UnoCSS with custom shortcuts
- Content: Nuxt Content for markdown processing
- Animations: VueUse Motion
- Icons: Iconify
- Theme: @nuxtjs/color-mode
- Language: TypeScript
- Node.js (version 16.x or higher)
- Yarn or npm package manager
-
Clone the repository
git clone https://github.com/fzzv/nuxt-blog.git cd nuxt-blog -
Install dependencies
# Using yarn (recommended) yarn install # Or using npm npm install
-
Start development server
# Using yarn yarn dev # Or using npm npm run dev
-
Open your browser Navigate to
http://localhost:3000to see your blog in action!
# Start development server with hot reload
yarn dev
# Build for production
yarn build
# Generate static site
yarn generate
# Preview production build
yarn preview-
Create a new markdown file in the
content/posts/directory -
Add frontmatter with title, description, tags, and date:
--- title: "Your Post Title" description: "Brief description of your post" tags: [vue, nuxt, javascript] date: 2024-01-15 --- # Your Post Content Write your blog post content here using markdown syntax.
-
The post will automatically appear on your blog homepage
nuxt-blog/
βββ components/ # Vue components
β βββ content/ # Content-specific components
β βββ ArticleCard.vue # Blog post card component
β βββ TheHeader.vue # Site header
β βββ TheFooter.vue # Site footer
β βββ ... # Other UI components
βββ composables/ # Vue composables
β βββ dark.ts # Dark mode logic
β βββ useTheme.ts # Theme management
β βββ ... # Other composables
βββ content/ # Blog content
β βββ posts/ # Blog posts (markdown files)
βββ layouts/ # Nuxt layouts
β βββ default.vue # Default layout
βββ pages/ # Nuxt pages
β βββ index.vue # Homepage
β βββ about.vue # About page
β βββ posts/ # Post pages
βββ public/ # Static assets
β βββ images/ # Images and icons
βββ styles/ # Global styles
β βββ index.css # Main stylesheet
β βββ markdown.css # Markdown styling
βββ types/ # TypeScript type definitions
βββ nuxt.config.ts # Nuxt configuration
βββ unocss.config.ts # UnoCSS configuration
βββ package.json # Project dependencies
The blog supports extensive customization through various configuration files:
- Custom shortcuts for common styling patterns
- Responsive breakpoints
- Icon and typography presets
- Custom color schemes
- SEO meta tags and site information
- Content highlighting themes
- Module configurations
Blog posts support the following frontmatter options:
---
title: "Post Title" # Required: Post title
description: "Post summary" # Required: Brief description
tags: [tag1, tag2] # Optional: Post tags
date: 2024-01-15 # Required: Publication date
---The project uses UnoCSS with custom shortcuts defined in unocss.config.ts:
fc- Flex center itemsfcc- Flex center items and justify centerbtn- Button stylingicon-btn- Icon button styling
Modify the color scheme by updating the UnoCSS configuration or CSS custom properties in the styles directory.
All components are located in the components/ directory and can be customized:
TheHeader.vue- Site navigation and brandingTheFooter.vue- Footer content and linksArticleCard.vue- Blog post preview cards- Theme components (
Sun.vue,Moon.vue) - Theme toggle animations
The project follows Vue 3 and TypeScript best practices:
- Composition API with
<script setup> - TypeScript for type safety
- Composables for reusable logic
- Component-based architecture
- Components: Add new Vue components in the
components/directory - Pages: Create new pages in the
pages/directory (auto-routed) - Composables: Add reusable logic in the
composables/directory - Styles: Add global styles in the
styles/directory - Types: Define TypeScript types in the
types/directory
For optimal development experience:
- Use VS Code with Vue and TypeScript extensions
- Enable format on save
- Use the Vue DevTools browser extension
| Script | Description |
|---|---|
yarn dev |
Start development server with hot reload |
yarn build |
Build the application for production |
yarn generate |
Generate static site for deployment |
yarn preview |
Preview the production build locally |
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Fan - Blog author and developer
- Nuxt.js team for the amazing framework
- Vue.js team for the reactive framework
- UnoCSS for the atomic CSS engine
- VueUse for the collection of Vue composition utilities
Happy blogging! π