Getting Started with Weblog
A comprehensive guide to setting up and configuring your Weblog site
Getting Started with Weblog
Welcome to Weblog! This guide will walk you through the process of setting up and configuring your own blog using this template.
Live Demo
You can check out the live demo at ultimate-kernel.fun/Weblog
This demo showcases:
- Clean and modern design
- Dark/Light mode support
- Bilingual support (English/Chinese)
- Responsive layout
- Frosted glass navigation
- Tech stack carousel
- Blog with tags and archive
Prerequisites
Before you begin, make sure you have the following installed:
Quick Start
- Clone the repository:
git clone https://github.com/aaronlamz/Weblog.git
cd Weblog
- Install dependencies:
pnpm install
- Start the development server:
pnpm dev
Your site should now be running at http://localhost:3000
!
Configuration
Basic Site Configuration
The main configuration file is located at src/config/site.config.ts
. Here are the key sections you'll want to customize:
export const siteConfig = {
name: 'Your Site Name',
title: 'Your Site Title',
description: 'Your site description',
author: {
name: 'Your Name',
email: 'your.email@example.com',
avatar: 'https://github.com/yourusername.png', // GitHub avatar or any image URL
bio: 'Your short bio',
},
social: {
github: 'https://github.com/yourusername',
twitter: 'https://twitter.com/yourusername',
email: 'your.email@example.com',
}
}
Setting Up Comments with Giscus
Weblog uses Giscus for comments, which is powered by GitHub Discussions. Here's how to set it up:
-
Make sure your repository is public
-
Enable GitHub Discussions in your repository:
- Go to your repository settings
- Scroll down to "Features"
- Check "Discussions"
-
Install the Giscus GitHub App
- Visit the Giscus app page
- Click "Install"
- Select your repository
-
Get your Giscus configuration:
- Visit giscus.app
- Enter your repository information
- Copy the generated configuration
-
Update the Giscus configuration in
src/components/comments.tsx
:
<Giscus
repo="yourusername/yourrepo"
repoId="your-repo-id"
category="Announcements"
categoryId="your-category-id"
mapping="pathname"
theme={theme === 'dark' ? 'dark_dimmed' : 'light'}
lang={locale === 'zh' ? 'zh-CN' : 'en'}
/>
Internationalization (i18n)
Weblog supports both English and Chinese out of the box. The translations are stored in:
messages/en.json
for Englishmessages/zh.json
for Chinese
To add or modify translations:
- Add your text to both language files
- Use the translation keys in your components:
const t = useTranslations('namespace')
// ...
<div>{t('key')}</div>
Writing Blog Posts
Blog posts are written in MDX and stored in:
content/blog/en/
for English postscontent/blog/zh/
for Chinese posts
Each post should include frontmatter:
---
title: "Your Post Title"
description: "A brief description"
date: "2024-03-20"
featured: false
---
Your content here...
Deployment
GitHub Pages
- Update
next.config.js
:
const basePath = process.env.BASE_PATH || ''
const isProduction = process.env.NODE_ENV === 'production'
const nextConfig = {
output: isProduction ? 'export' : undefined,
basePath: isProduction ? basePath : '',
}
-
Configure GitHub Actions:
- The workflow file is already set up in
.github/workflows/deploy.yml
- Enable GitHub Pages in your repository settings
- Set the source to "GitHub Actions"
- The workflow file is already set up in
-
Push your changes:
git add .
git commit -m "Configure for deployment"
git push
Your site will be automatically deployed to GitHub Pages!
Customization
Styling
Weblog uses Tailwind CSS for styling. The main configuration files are:
tailwind.config.ts
- Tailwind configurationsrc/styles/globals.css
- Global styles- Individual component styles are written using Tailwind classes
Components
Key components you might want to customize:
src/components/header.tsx
- Navigation and site headersrc/components/footer.tsx
- Site footersrc/components/theme-toggle.tsx
- Dark/light mode togglesrc/components/language-switcher.tsx
- Language switcher
Need Help?
If you run into any issues:
- Check the GitHub Issues
- Create a new issue if you can't find a solution
- Join the discussion in GitHub Discussions
Happy blogging! 🎉