Skip to content

Commit 3a9957e

Browse files
Copilotjaypatrick
andauthored
Add Gatsby documentation website with GitHub Pages deployment (#199)
* Initial plan * Add Gatsby website with documentation organization Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com> * Update README with documentation website links Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
1 parent d42d2d7 commit 3a9957e

19 files changed

Lines changed: 20695 additions & 0 deletions

File tree

.github/workflows/gatsby.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and Deploy Gatsby Website
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/website/**'
9+
- 'docs/**'
10+
- '.github/workflows/gatsby.yml'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
defaults:
26+
run:
27+
working-directory: src/website
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '20'
36+
cache: 'npm'
37+
cache-dependency-path: src/website/package-lock.json
38+
39+
- name: Setup Pages
40+
id: pages
41+
uses: actions/configure-pages@v4
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Build Gatsby site
47+
run: npm run build
48+
env:
49+
PREFIX_PATHS: true
50+
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: src/website/public
55+
56+
deploy:
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
runs-on: ubuntu-latest
61+
needs: build
62+
steps:
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v4

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
A comprehensive multi-language toolkit for ad-blocking, network protection, and AdGuard DNS management. Features filter rule compilers in **5 languages** (TypeScript, .NET, Python, Rust, PowerShell), plus complete **API SDKs for AdGuard DNS** in both C# and Rust with interactive console interfaces.
1414

15+
📚 **[View Documentation Website](https://jaypatrick.github.io/ad-blocking)** - User-friendly documentation for all features and recent improvements.
16+
1517
## Table of Contents
1618

1719
- [Features](#features)
@@ -154,6 +156,11 @@ ad-blocking/
154156
│ ├── adguard-validation/ # Rust validation library
155157
│ │ ├── adguard-validation-core/ # Core validation logic
156158
│ │ └── adguard-validation-cli/ # CLI tool
159+
│ ├── website/ # Gatsby documentation website
160+
│ │ ├── src/pages/ # Static pages (home, getting started)
161+
│ │ ├── src/templates/ # Dynamic page templates
162+
│ │ ├── src/components/ # React components
163+
│ │ └── gatsby-config.js # Gatsby configuration
157164
│ └── linear/ # Linear integration scripts
158165
├── tools/ # Utility and build scripts
159166
│ ├── README.md # Tools documentation
@@ -1463,6 +1470,17 @@ Download the latest release from the [Releases page](https://github.com/jaypatri
14631470

14641471
## Documentation
14651472

1473+
### 📚 Documentation Website
1474+
1475+
**[https://jaypatrick.github.io/ad-blocking](https://jaypatrick.github.io/ad-blocking)**
1476+
1477+
A user-friendly Gatsby-powered website with:
1478+
- Organized documentation by category (Getting Started, Guides, API, Technical)
1479+
- Recent improvements and changelog
1480+
- Responsive design for desktop and mobile
1481+
- Full-text search across all documentation
1482+
- Direct links to all 58+ markdown files
1483+
14661484
### Getting Started
14671485

14681486
- [Getting Started Guide](docs/getting-started.md) - Quick installation and first compilation

src/website/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build output
2+
.cache/
3+
public/
4+
5+
# Dependencies
6+
node_modules/
7+
8+
# Logs
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
13+
# IDE
14+
.DS_Store
15+
.vscode/
16+
.idea/
17+
18+
# Gatsby
19+
.env*
20+
!.env.example

src/website/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Ad-Blocking Toolkit Website
2+
3+
This is a Gatsby-powered documentation website for the Ad-Blocking repository.
4+
5+
## Development
6+
7+
```bash
8+
# Install dependencies
9+
npm install
10+
11+
# Start development server
12+
npm run develop
13+
14+
# Build for production
15+
npm run build
16+
17+
# Serve production build
18+
npm run serve
19+
```
20+
21+
## Structure
22+
23+
- `src/pages/` - Static pages (home, getting started, etc.)
24+
- `src/templates/` - Templates for dynamically generated pages
25+
- `src/components/` - Reusable React components
26+
- `src/styles/` - Global CSS styles
27+
- `gatsby-config.js` - Gatsby configuration
28+
- `gatsby-node.js` - Node APIs for page generation
29+
30+
## Features
31+
32+
- 📚 Automatic documentation from markdown files
33+
- 🔍 Organized by category (Guides, API, Technical)
34+
- 📱 Responsive design
35+
- 🚀 Fast static site generation
36+
- 🎨 Clean, accessible UI
37+
38+
## Deployment
39+
40+
The site is automatically built and deployed to GitHub Pages when changes are pushed to the main branch.
41+
42+
Site URL: https://jaypatrick.github.io/ad-blocking

src/website/gatsby-config.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Gatsby configuration for Ad-Blocking documentation website
3+
* @type {import('gatsby').GatsbyConfig}
4+
*/
5+
module.exports = {
6+
siteMetadata: {
7+
title: `Ad-Blocking Toolkit`,
8+
description: `A comprehensive multi-language toolkit for ad-blocking, network protection, and AdGuard DNS management`,
9+
author: `Ad-Blocking Contributors`,
10+
siteUrl: `https://jaypatrick.github.io/ad-blocking`,
11+
},
12+
pathPrefix: `/ad-blocking`,
13+
plugins: [
14+
`gatsby-plugin-image`,
15+
`gatsby-plugin-sharp`,
16+
`gatsby-transformer-sharp`,
17+
{
18+
resolve: `gatsby-source-filesystem`,
19+
options: {
20+
name: `docs`,
21+
path: `${__dirname}/../../docs`,
22+
},
23+
},
24+
{
25+
resolve: `gatsby-source-filesystem`,
26+
options: {
27+
name: `root-docs`,
28+
path: `${__dirname}/../..`,
29+
ignore: [`**/node_modules/**`, `**/.*`, `**/data/**`, `**/src/**`, `**/.github/**`, `**/tools/**`, `**/api/**`],
30+
},
31+
},
32+
{
33+
resolve: `gatsby-transformer-remark`,
34+
options: {
35+
plugins: [],
36+
},
37+
},
38+
{
39+
resolve: `gatsby-plugin-manifest`,
40+
options: {
41+
name: `Ad-Blocking Toolkit`,
42+
short_name: `Ad-Blocking`,
43+
start_url: `/`,
44+
background_color: `#663399`,
45+
theme_color: `#663399`,
46+
display: `minimal-ui`,
47+
icon: `src/images/icon.svg`,
48+
},
49+
},
50+
],
51+
}

src/website/gatsby-node.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const path = require(`path`)
2+
const { createFilePath } = require(`gatsby-source-filesystem`)
3+
4+
exports.onCreateNode = ({ node, getNode, actions }) => {
5+
const { createNodeField } = actions
6+
7+
if (node.internal.type === `MarkdownRemark`) {
8+
const slug = createFilePath({ node, getNode, basePath: `docs` })
9+
createNodeField({
10+
node,
11+
name: `slug`,
12+
value: slug,
13+
})
14+
}
15+
}
16+
17+
exports.createPages = async ({ graphql, actions }) => {
18+
const { createPage } = actions
19+
20+
const result = await graphql(`
21+
query {
22+
allMarkdownRemark {
23+
nodes {
24+
id
25+
fields {
26+
slug
27+
}
28+
}
29+
}
30+
}
31+
`)
32+
33+
const docTemplate = path.resolve(`./src/templates/doc.js`)
34+
35+
result.data.allMarkdownRemark.nodes.forEach((node) => {
36+
createPage({
37+
path: node.fields.slug,
38+
component: docTemplate,
39+
context: {
40+
id: node.id,
41+
},
42+
})
43+
})
44+
}

0 commit comments

Comments
 (0)