Skip to content

Commit 9e74616

Browse files
authored
Merge pull request #2 from GravityKit/develop
Centralize product configuration and enhance home page
2 parents d79fe5b + ad8ec0f commit 9e74616

38 files changed

Lines changed: 728 additions & 317 deletions

README.md

Lines changed: 83 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,46 +269,123 @@ gravitykit.dev/
269269

270270
### repos-config.json
271271

272-
Central configuration file mapping products to GitHub repositories:
272+
Central configuration file mapping products to GitHub repositories. This file controls repository cloning, documentation generation, and navigation structure.
273+
274+
#### Schema Overview
273275

274276
```json
275277
{
278+
"$schema": "./repos-config.schema.json",
276279
"reposDir": "./repos",
277280
"outputDir": "./docs",
278281
"defaults": {
279282
"branch": "develop",
280283
"ignoreFiles": ["**/vendor/**", "**/node_modules/**"],
281-
"ignoreHooks": ["deprecated_*", "private_*"]
284+
"ignoreHooks": ["deprecated_*", "private_*"],
285+
"customFields": {
286+
"since": true,
287+
"deprecated": true,
288+
"internal": false,
289+
"example": true
290+
}
291+
},
292+
"categories": {
293+
"gravityview": {
294+
"label": "GravityView",
295+
"position": 1
296+
},
297+
"gravityview-extensions": {
298+
"label": "Extensions",
299+
"parent": "gravityview",
300+
"position": 2
301+
}
282302
},
283303
"products": [
284304
{
285305
"id": "gravityview",
286306
"repo": "GravityKit/GravityView",
287307
"label": "GravityView",
288-
"routeBasePath": "docs/gravityview"
308+
"category": "gravityview",
309+
"purchaseUrl": "https://www.gravitykit.com/products/gravityview/"
289310
}
290311
]
291312
}
292313
```
293314

315+
#### Top-Level Fields
316+
317+
| Field | Type | Description |
318+
|-------|------|-------------|
319+
| `reposDir` | string | Directory where repos are cloned (default: `./repos`) |
320+
| `outputDir` | string | Directory for generated documentation (default: `./docs`) |
321+
| `defaults` | object | Default settings applied to all products |
322+
| `categories` | object | Navigation groupings for the site navbar |
323+
| `products` | array | List of product configurations |
324+
325+
#### Categories
326+
327+
Categories control how products are grouped in the site navigation. Each category can have:
328+
329+
| Field | Type | Description |
330+
|-------|------|-------------|
331+
| `label` | string | Display name in navigation |
332+
| `parent` | string | Parent category ID (for nested dropdowns) |
333+
| `position` | number | Sort order in navigation |
334+
335+
**Current category structure:**
336+
- `gravityview` - Main GravityView dropdown
337+
- `gravityview-extensions` - Extensions submenu
338+
- `gravityview-layouts` - Layouts submenu
339+
- `gravitykit` - GravityKit Products dropdown
340+
- `gravity-forms` - Gravity Forms Add-Ons dropdown
341+
342+
#### Product Fields
343+
344+
| Field | Type | Required | Description |
345+
|-------|------|----------|-------------|
346+
| `id` | string | Yes | Unique identifier, used in URLs (e.g., `gravityview`) |
347+
| `repo` | string | Yes | GitHub repository path (e.g., `GravityKit/GravityView`) |
348+
| `label` | string | Yes | Display name (e.g., `GravityView`) |
349+
| `category` | string | Yes | Category ID for navigation grouping |
350+
| `purchaseUrl` | string | No | URL to product purchase page |
351+
| `isFree` | boolean | No | Set to `true` for free products |
352+
| `branch` | string | No | Override default branch |
353+
| `ignoreFiles` | array | No | Additional glob patterns to ignore |
354+
| `ignoreHooks` | array | No | Additional hook patterns to ignore |
355+
294356
### Adding a New Product
295357

296-
1. Add an entry to `repos-config.json`:
358+
1. Add an entry to `repos-config.json` under `products`:
297359

298360
```json
299361
{
300362
"id": "new-product",
301363
"repo": "GravityKit/NewProduct",
302364
"label": "New Product Name",
303-
"routeBasePath": "docs/new-product"
365+
"category": "gravitykit",
366+
"purchaseUrl": "https://www.gravitykit.com/products/new-product/"
367+
}
368+
```
369+
370+
2. If needed, add a new category:
371+
372+
```json
373+
{
374+
"categories": {
375+
"new-category": {
376+
"label": "New Category",
377+
"position": 4
378+
}
379+
}
304380
}
305381
```
306382

307-
2. Regenerate documentation:
383+
3. Regenerate documentation:
308384

309385
```bash
310386
npm run repos:clone -- --product new-product
311387
npm run hooks:generate -- --product new-product
388+
npm run api:generate -- --filter new-product
312389
```
313390

314391
## Deployment

docusaurus.config.js

Lines changed: 101 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,103 @@ const llms_sitemap_paths = [
4141
...products_with_docs.map((product) => `docs/${product.id}/llms.txt`),
4242
];
4343

44-
// Generate navigation items from products
45-
const product_nav_items = config_products
46-
.filter((product) => product?.label && product?.id)
47-
.map((product) => ({
48-
label: product.label,
49-
href: `/docs/${product.id}/`,
50-
}));
44+
// Generate navigation items grouped by category
45+
const categories = repos_config.categories || {};
46+
47+
// Helper to get products by category
48+
function getProductsByCategory(categoryId) {
49+
return config_products
50+
.filter((p) => p?.category === categoryId && p?.label && p?.id)
51+
.map((p) => ({
52+
label: p.label,
53+
href: `/docs/${p.id}/`,
54+
}));
55+
}
56+
57+
// Helper to get free add-ons (products with isFree: true)
58+
function getFreeProducts() {
59+
return config_products
60+
.filter((p) => p?.isFree === true && p?.label && p?.id)
61+
.map((p) => ({
62+
label: p.label,
63+
href: `/docs/${p.id}/`,
64+
}));
65+
}
66+
67+
// Helper to get third-party products (products with isThirdParty: true)
68+
function getThirdPartyProducts() {
69+
return config_products
70+
.filter((p) => p?.isThirdParty === true && p?.label && p?.id)
71+
.map((p) => ({
72+
label: p.label,
73+
href: `/docs/${p.id}/`,
74+
}));
75+
}
76+
77+
// Build GravityView dropdown with nested extensions and layouts
78+
const gravityview_nav = {
79+
label: 'GravityView',
80+
position: 'left',
81+
items: [
82+
{ label: 'GravityView', href: '/docs/gravityview/' },
83+
{
84+
type: 'html',
85+
value: '<hr class="dropdown-separator">',
86+
},
87+
{
88+
type: 'html',
89+
value: '<span class="dropdown-heading">Extensions</span>',
90+
className: 'dropdown-heading-item',
91+
},
92+
...getProductsByCategory('gravityview-extensions'),
93+
{
94+
type: 'html',
95+
value: '<hr class="dropdown-separator">',
96+
},
97+
{
98+
type: 'html',
99+
value: '<span class="dropdown-heading">Layouts</span>',
100+
className: 'dropdown-heading-item',
101+
},
102+
...getProductsByCategory('gravityview-layouts'),
103+
],
104+
};
105+
106+
// Build GravityKit Products dropdown (includes GravityView, free add-ons, and third-party)
107+
const gravitykit_nav = {
108+
label: 'GravityKit Products',
109+
position: 'left',
110+
items: [
111+
...getProductsByCategory('gravitykit'),
112+
{ label: 'GravityView', href: '/docs/gravityview/' },
113+
{
114+
type: 'html',
115+
value: '<hr class="dropdown-separator">',
116+
},
117+
{
118+
type: 'html',
119+
value: '<span class="dropdown-heading">Free Add-Ons</span>',
120+
className: 'dropdown-heading-item',
121+
},
122+
...getFreeProducts(),
123+
{
124+
type: 'html',
125+
value: '<hr class="dropdown-separator">',
126+
},
127+
{
128+
type: 'html',
129+
value: '<span class="dropdown-heading">Third Party</span>',
130+
className: 'dropdown-heading-item',
131+
},
132+
...getThirdPartyProducts(),
133+
],
134+
};
135+
136+
// Helper to get purchase URL for a product from repos-config.json
137+
function getProductPurchaseUrl(productId) {
138+
const product = config_products.find((p) => p.id === productId);
139+
return product?.purchaseUrl || null;
140+
}
51141

52142
// Generate docs plugins for each product
53143
// Documentation is generated to ./docs/{product-id}/
@@ -273,10 +363,11 @@ const config = {
273363
src: 'img/gravitykit-icon.svg',
274364
},
275365
items: [
366+
gravitykit_nav,
367+
gravityview_nav,
276368
{
277-
label: 'Products',
278-
position: 'left',
279-
items: product_nav_items,
369+
type: 'custom-productLearnMoreLink',
370+
position: 'right',
280371
},
281372
],
282373
},

0 commit comments

Comments
 (0)