A modern, lightweight blog built with React, TypeScript, and Vite. This blog replaces the previous Hexo-based setup with a custom solution that provides better control, modern development experience, and serves as a portfolio piece.
- Modern Stack: React + TypeScript + Vite for fast development and optimal performance
- Markdown Support: Write posts in markdown with full GitHub Flavored Markdown support
- Syntax Highlighting: Beautiful code highlighting using Prism
- Search: Client-side search across all posts (title, content, tags)
- Tag Filtering: Filter posts by tags
- Featured Posts: Showcase section for recent posts
- Mobile Responsive: Works great on all devices
- Fast: Static site generation with optimal loading performance
- GitHub Actions: Automated deployment to GitHub Pages
Blog/
βββ .github/
β βββ workflows/
β βββ deploy.yml # GitHub Actions deployment
βββ public/
β βββ posts/ # Markdown blog posts
β βββ post-1.md
β βββ post-2.md
β βββ ...
βββ src/
β βββ components/ # React components
β β βββ PostList.tsx # List of posts
β β βββ PostDetail.tsx # Individual post view
β β βββ SearchBar.tsx # Search functionality
β β βββ TagFilter.tsx # Tag filtering
β β βββ FeaturedPosts.tsx # Featured/recent posts
β β βββ Header.tsx # Site header
β β βββ Footer.tsx # Site footer
β βββ pages/ # Page components
β β βββ Home.tsx # Home page
β β βββ TagPage.tsx # Tag-filtered page
β βββ utils/ # Utility functions
β β βββ posts.ts # Post loading/parsing
β β βββ search.ts # Search functionality
β βββ types/ # TypeScript types
β β βββ Post.ts # Post interfaces
β βββ App.tsx # Main app component
β βββ App.css # App styles
β βββ main.tsx # Entry point
β βββ index.css # Global styles
βββ package.json
βββ tsconfig.json
βββ vite.config.ts
βββ README.md
- Node.js 18+
- npm or yarn
- Clone the repository:
git clone https://github.com/yourusername/Blog.git
cd Blog- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser to
http://localhost:5173
npm run buildThe built files will be in the dist/ directory.
npm run preview- Create a new markdown file in
public/posts/:
touch public/posts/my-new-post.md- Add frontmatter at the top of the file:
---
title: "My New Post Title"
date: 2025-12-11 10:00:00
tags:
- JavaScript
- React
- TypeScript
featured: false
---
Your post content starts here...title(required): The post titledate(required): Publication date inYYYY-MM-DD HH:mm:ssformattags(optional): Array of tagsfeatured(optional): Set totrueto feature this post
- Headers: Use
#,##,###, etc. - Code blocks: Use triple backticks with language:
```typescript const greeting: string = "Hello, World!"; ```
- Lists: Both ordered and unordered
- Links:
[text](url) - Images:
 - Tables: GitHub Flavored Markdown tables
- Blockquotes: Use
>
Use kebab-case for filenames: my-awesome-post.md
The filename becomes the URL slug: /post/my-awesome-post
This blog is configured to deploy automatically to GitHub Pages using GitHub Actions.
- Push your code to GitHub:
git add .
git commit -m "Initial commit"
git push origin main-
Enable GitHub Pages:
- Go to your repository Settings
- Navigate to Pages
- Under "Build and deployment" β Source, select "GitHub Actions"
-
The blog will automatically deploy on every push to
main -
Access your blog at:
https://yourusername.github.io/Blog/
- Add a
CNAMEfile to thepublic/directory with your domain - Configure your DNS settings to point to GitHub Pages
- Update the
baseinvite.config.tsto/instead of/Blog/
Edit src/App.css and src/index.css to customize the look and feel.
Key CSS variables in src/index.css:
--primary-color: #2563eb;
--text-color: #1f2937;
--bg-color: #ffffff;
--bg-secondary: #f9fafb;Update the site title in src/components/Header.tsx:
<h1>Your Blog Title</h1>If deploying to a different path, update vite.config.ts:
base: '/your-repo-name/',And update App.tsx:
<Router basename="/your-repo-name">- React 18: UI library
- TypeScript: Type safety
- Vite: Build tool and dev server
- React Router: Client-side routing
- React Markdown: Markdown rendering
- Prism: Syntax highlighting
- Gray Matter: Frontmatter parsing
This blog was migrated from Hexo to provide:
- More control over features and styling
- Modern development experience
- Portfolio piece demonstrating React + TypeScript skills
- Simpler deployment workflow (single repo vs. two)
- Faster build times
See the migration blog post for details: [Coming soon]
- Verify the markdown files are in
public/posts/ - Check that frontmatter is valid YAML
- Ensure date is in correct format:
YYYY-MM-DD HH:mm:ss
- Clear
node_modulesand reinstall:rm -rf node_modules && npm install - Clear Vite cache:
rm -rf node_modules/.vite
- Verify
baseinvite.config.tsmatches your repository name - Ensure GitHub Actions workflow has proper permissions
- Check that GitHub Pages is enabled in repository settings
MIT License - feel free to use this as a template for your own blog!
This is a personal blog, but suggestions and improvements are welcome via issues or pull requests.
Built with β€οΈ using React, TypeScript, and Vite