|
| 1 | +# GitHub Pages Setup Guide |
| 2 | + |
| 3 | +This guide will help you set up GitHub Pages for the libxev-http project. |
| 4 | + |
| 5 | +## 🚀 Quick Deployment Steps |
| 6 | + |
| 7 | +### 1. Enable GitHub Pages |
| 8 | + |
| 9 | +1. Go to your GitHub repository |
| 10 | +2. Click the **Settings** tab |
| 11 | +3. Find **Pages** in the left sidebar |
| 12 | +4. Under **Build and deployment**: |
| 13 | + - **Source**: Select "Deploy from a branch" |
| 14 | + - **Branch**: Choose **main** branch and **/docs** folder |
| 15 | + - Click **Save** |
| 16 | + |
| 17 | +**Note**: GitHub Pages now uses GitHub Actions to execute Jekyll builds. Make sure GitHub Actions is enabled in your repository. |
| 18 | + |
| 19 | +### 2. Update Configuration |
| 20 | + |
| 21 | +Edit the `docs/_config.yml` file and update the following: |
| 22 | + |
| 23 | +```yaml |
| 24 | +url: "https://YOUR-USERNAME.github.io" |
| 25 | +baseurl: "/libxev-http" # or your repository name |
| 26 | +repository: "YOUR-USERNAME/libxev-http" |
| 27 | +``` |
| 28 | +
|
| 29 | +Replace `YOUR-USERNAME` with your actual GitHub username. |
| 30 | + |
| 31 | +### 3. Update HTML Links |
| 32 | + |
| 33 | +Replace all instances of `your-username` with your actual GitHub username in: |
| 34 | + |
| 35 | +- `docs/index.html` |
| 36 | +- `docs/api.html` |
| 37 | +- `docs/examples.html` |
| 38 | + |
| 39 | +Search and replace: |
| 40 | +```html |
| 41 | +<!-- Before --> |
| 42 | +<a href="https://github.com/your-username/libxev-http"> |
| 43 | +
|
| 44 | +<!-- After --> |
| 45 | +<a href="https://github.com/YOUR-USERNAME/libxev-http"> |
| 46 | +``` |
| 47 | + |
| 48 | +### 4. Update robots.txt |
| 49 | + |
| 50 | +Edit `docs/robots.txt`: |
| 51 | + |
| 52 | +``` |
| 53 | +User-agent: * |
| 54 | +Allow: / |
| 55 | +
|
| 56 | +Sitemap: https://YOUR-USERNAME.github.io/libxev-http/sitemap.xml |
| 57 | +``` |
| 58 | + |
| 59 | +## 🔧 Custom Configuration |
| 60 | + |
| 61 | +### Custom Domain (Optional) |
| 62 | + |
| 63 | +If you have a custom domain: |
| 64 | + |
| 65 | +1. Create `docs/CNAME` file: |
| 66 | + ``` |
| 67 | + libxev-http.yourdomain.com |
| 68 | + ``` |
| 69 | + |
| 70 | +2. Configure DNS records: |
| 71 | + ``` |
| 72 | + CNAME libxev-http.yourdomain.com YOUR-USERNAME.github.io |
| 73 | + ``` |
| 74 | + |
| 75 | +3. Update `_config.yml`: |
| 76 | + ```yaml |
| 77 | + url: "https://libxev-http.yourdomain.com" |
| 78 | + baseurl: "" |
| 79 | + ``` |
| 80 | + |
| 81 | +### Custom Styling |
| 82 | + |
| 83 | +Edit `docs/style.css` to customize colors and styles: |
| 84 | + |
| 85 | +```css |
| 86 | +:root { |
| 87 | + --primary-color: #f7931e; /* Primary color */ |
| 88 | + --secondary-color: #2563eb; /* Secondary color */ |
| 89 | + --accent-color: #10b981; /* Accent color */ |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +### Add Google Analytics (Optional) |
| 94 | + |
| 95 | +Add to `docs/_config.yml`: |
| 96 | + |
| 97 | +```yaml |
| 98 | +google_analytics: UA-XXXXXXXX-X |
| 99 | +``` |
| 100 | + |
| 101 | +## 📁 File Structure |
| 102 | + |
| 103 | +``` |
| 104 | +docs/ |
| 105 | +├── index.html # Homepage |
| 106 | +├── api.html # API documentation |
| 107 | +├── examples.html # Code examples |
| 108 | +├── style.css # Stylesheet |
| 109 | +├── script.js # JavaScript functionality |
| 110 | +├── _config.yml # Jekyll configuration |
| 111 | +├── Gemfile # Ruby dependencies |
| 112 | +├── robots.txt # Search engine configuration |
| 113 | +├── manifest.json # PWA configuration |
| 114 | +├── 404.html # Custom 404 page |
| 115 | +├── sitemap.xml # Site map |
| 116 | +└── README.md # Documentation |
| 117 | +``` |
| 118 | +
|
| 119 | +## 🚀 自动部署 |
| 120 | +
|
| 121 | +### GitHub Actions Workflow |
| 122 | +
|
| 123 | +The project includes a GitHub Actions workflow (`.github/workflows/pages.yml`) that automatically deploys when: |
| 124 | +
|
| 125 | +- Pushing to the main branch |
| 126 | +- Changes are made to the `docs/` directory |
| 127 | +- Manually triggering the workflow |
| 128 | +
|
| 129 | +### Deployment Options |
| 130 | +
|
| 131 | +**Option 1: Use GitHub Actions (Recommended)** |
| 132 | +- Automatic Jekyll build and deployment |
| 133 | +- Support for custom plugins and themes |
| 134 | +- Better build error reporting |
| 135 | +
|
| 136 | +**Option 2: Deploy Static Files Directly** |
| 137 | +If you want to bypass Jekyll processing: |
| 138 | +1. Rename `docs/.nojekyll.example` to `docs/.nojekyll` |
| 139 | +2. Remove or rename `_config.yml` and `Gemfile` |
| 140 | +3. GitHub Pages will serve HTML files directly |
| 141 | +
|
| 142 | +## 🌐 Access Your Website |
| 143 | +
|
| 144 | +After deployment, your website will be available at: |
| 145 | +
|
| 146 | +``` |
| 147 | +https://YOUR-USERNAME.github.io/libxev-http/ |
| 148 | +``` |
| 149 | +
|
| 150 | +## 🎨 Website Features |
| 151 | +
|
| 152 | +### Responsive Design |
| 153 | +- Mobile-friendly navigation |
| 154 | +- Responsive grid layouts |
| 155 | +- Touch-friendly interactions |
| 156 | +
|
| 157 | +### Interactive Features |
| 158 | +- Copy-to-clipboard for code examples |
| 159 | +- Smooth scrolling navigation |
| 160 | +- Animated elements on scroll |
| 161 | +
|
| 162 | +### SEO Optimized |
| 163 | +- Social sharing meta tags |
| 164 | +- Structured data |
| 165 | +- Automatic sitemap generation |
| 166 | +
|
| 167 | +### Performance Optimized |
| 168 | +- Compressed CSS and JavaScript |
| 169 | +- Optimized asset loading |
| 170 | +- Fast loading times |
| 171 | +
|
| 172 | +## 🔍 Local Development |
| 173 | +
|
| 174 | +If you want to preview the website locally: |
| 175 | +
|
| 176 | +1. Install Ruby and Bundler |
| 177 | +2. Navigate to docs directory: |
| 178 | + ```bash |
| 179 | + cd docs |
| 180 | + ``` |
| 181 | +3. Install dependencies: |
| 182 | + ```bash |
| 183 | + bundle install |
| 184 | + ``` |
| 185 | +4. Start local server: |
| 186 | + ```bash |
| 187 | + bundle exec jekyll serve |
| 188 | + ``` |
| 189 | +5. Visit `http://localhost:4000` in your browser |
| 190 | + |
| 191 | +## 🐛 Troubleshooting |
| 192 | + |
| 193 | +### Site Not Loading |
| 194 | +- Check GitHub Pages settings |
| 195 | +- Verify `_config.yml` syntax |
| 196 | +- Check for build errors in Actions tab |
| 197 | + |
| 198 | +### Broken Links |
| 199 | +- Update all internal links to use relative paths |
| 200 | +- Check external links periodically |
| 201 | +- Use proper baseurl configuration |
| 202 | + |
| 203 | +### Styling Issues |
| 204 | +- Clear browser cache |
| 205 | +- Check CSS syntax |
| 206 | +- Verify file paths |
| 207 | + |
| 208 | +## 📚 Useful Resources |
| 209 | + |
| 210 | +- [GitHub Pages Documentation](https://docs.github.com/en/pages) |
| 211 | +- [Jekyll Documentation](https://jekyllrb.com/docs/) |
| 212 | +- [Markdown Guide](https://www.markdownguide.org/) |
| 213 | + |
| 214 | +## 🤝 Contributing |
| 215 | + |
| 216 | +To contribute to the website: |
| 217 | + |
| 218 | +1. Fork the repository |
| 219 | +2. Make changes in the `docs/` directory |
| 220 | +3. Test locally if possible |
| 221 | +4. Submit a Pull Request |
| 222 | + |
| 223 | +## ✅ Deployment Checklist |
| 224 | + |
| 225 | +- [ ] Enable GitHub Pages |
| 226 | +- [ ] Ensure GitHub Actions is enabled |
| 227 | +- [ ] Update URL and repository info in `_config.yml` |
| 228 | +- [ ] Replace all `your-username` in HTML files |
| 229 | +- [ ] Update sitemap URL in `robots.txt` |
| 230 | +- [ ] Test all links and functionality |
| 231 | +- [ ] Check mobile responsiveness |
| 232 | +- [ ] Verify SEO meta tags |
| 233 | +- [ ] Test 404 page functionality |
| 234 | +- [ ] Check HTTPS is working properly |
| 235 | + |
| 236 | +After completing these steps, your libxev-http project will have a professional GitHub Pages website! |
0 commit comments