How to Fork gitWiki
This guide will help you create your own version of gitWiki. Follow these steps to get started with your own documentation site.
Step 1: Fork the Repository
- Go to the gitWiki repository on GitHub
- Click the "Fork" button in the top-right corner
- Select your account as the destination for the fork
Step 2: Configure Your Wiki
Update Repository Settings
- Go to your forked repository's settings
- Rename the repository if desired
Customize Configuration
- Edit
lib/config.ts
:
export const GITHUB_REPO = {
owner: 'your-username', // Replace with your GitHub username
name: 'your-repo-name', // Replace with your repository name
branch: 'main', // Your default branch
contentPath: 'content' // Leave as is unless you change the content structure
}
- Update
package.json
:
{
"name": "your-wiki-name",
"version": "0.1.0",
"private": true
}
Step 3: Customize Content
- Edit
README.md
to create your homepage - Add your documentation files in the
content
directory - Organize content using folders for different sections
Content Structure Example
content/
├── getting-started/
│ ├── installation.md
│ └── configuration.md
├── guides/
│ └── advanced-usage.md
└── reference/
└── api.md
Step 4: Deploy
You have several options for deploying your wiki:
Option 1: Deploy to Vercel (Recommended)
- Go to Vercel
- Sign up or log in with your GitHub account
- Click "Import Project"
- Select your forked repository
- Keep the default settings (Vercel will auto-detect Next.js)
- Click "Deploy"
Your wiki will be live at https://your-project-name.vercel.app
Advantages of Vercel:
- Automatic deployments on every push
- Built-in SSL
- Global CDN
- Zero configuration needed
Option 2: Deploy to Netlify
- Go to Netlify
- Sign up or log in with your GitHub account
- Click "New site from Git"
- Select your forked repository
- Configure build settings:
- Build command:
npm run build
- Publish directory:
out
- Build command:
- Click "Deploy site"
Your wiki will be live at https://your-site-name.netlify.app
Environment Variables for Netlify:
NEXT_PUBLIC_BASE_PATH=
Option 3: Deploy to GitHub Pages
- In your repository settings, enable GitHub Pages
- Add the following to your
next.config.js
:
const nextConfig = {
output: 'export',
images: {
unoptimized: true
},
trailingSlash: true,
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
assetPrefix: process.env.NEXT_PUBLIC_BASE_PATH || ''
}
- Add this GitHub Action workflow (create
.github/workflows/deploy.yml
):
name: Deploy to GitHub Pages
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
NEXT_PUBLIC_BASE_PATH: /${{ github.event.repository.name }}
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: out
Your wiki will be live at https://your-username.github.io/your-repo-name
Step 5: Maintain Your Wiki
Adding New Content
- Create
.md
files in thecontent
directory - Add YAML front matter at the top:
---
title: Your Page Title
category: Your Category
---
- Write your content using Markdown
Updating Content
- Edit the relevant
.md
files - Commit and push your changes
- The site will automatically rebuild and deploy
Customization Options
Styling
- Edit
styles/globals.css
for site-wide styles - Modify
tailwind.config.js
for theme customization
Layout
- Customize components in the
components
directory - Modify
components/Layout.tsx
for layout changes
Need Help?
- Check the documentation
- Open an issue on GitHub
- Contribute improvements via pull requests
Deployment Tips
Common Issues
- Images not loading: Make sure to use relative paths and the
next/image
component - 404 on routes: Ensure
trailingSlash: true
is set innext.config.js
- Base path issues: Set the correct
NEXT_PUBLIC_BASE_PATH
for GitHub Pages
Performance Optimization
- Optimize images before uploading
- Use static generation for all pages
- Minimize JavaScript bundles
- Enable caching headers in your deployment platform
Security
- Keep dependencies updated
- Use environment variables for sensitive data
- Enable security headers in your deployment platform