Skip to content

Commit 2341797

Browse files
docs: initial changes to content and config for docusaurus (#1)
Added Docusaurus config for the new docs repo Signed-off-by: ANUSHKA SAXENA <[email protected]> Signed-off-by: ANUSHKA SAXENA <[email protected]> Signed-off-by: Gabriele Bartolini <[email protected]> Co-authored-by: Gabriele Bartolini <[email protected]> Signed-off-by: Gabriele Bartolini <[email protected]>
1 parent 3761bc1 commit 2341797

File tree

698 files changed

+126174
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

698 files changed

+126174
-2
lines changed

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,44 @@
2424
*~
2525

2626
# Dependency directories (remove the comment below to include it)
27+
node_modules/
2728
# vendor/
2829

2930
# Go workspace file
3031
go.work
32+
33+
# Production
34+
/build
35+
36+
# Generated files
37+
.docusaurus
38+
.cache-loader
39+
40+
# Misc
41+
.DS_Store
42+
.env.local
43+
.env.development.local
44+
.env.test.local
45+
.env.production.local
46+
47+
npm-debug.log*
48+
yarn-debug.log*
49+
yarn-error.log*
50+
package-lock.json
51+
yarn.lock
52+
53+
# Build and cache
54+
.cache/
55+
.docusaurus/
56+
build/
57+
58+
# Dependency dirs
59+
node_modules/
60+
node_modules copy/
61+
62+
# IDE
63+
.vscode/
64+
.idea/
65+
66+
# Misc
67+
.DS_Store

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ managing PostgreSQL workloads on Kubernetes from the CNCF.
1212
## LFX Mentorship 2025/3
1313

1414
This repository is part of the [LFX Mentorship 2025/3](https://mentorship.lfx.linuxfoundation.org/project/86a647c1-88c7-474f-b093-6abb58197083)
15-
programme, with **Anushka Agarwal** as the mentee.
15+
programme, with **Anushka Saxena** as the mentee.
1616
For more details, see [cloudnative-pg/cloudnative-pg#8122](https://github.com/cloudnative-pg/cloudnative-pg/issues/8122).
1717

1818
---
@@ -33,7 +33,47 @@ and make sure your work aligns with the project’s values and goals.
3333

3434
## Building the Documentation
3535

36-
TODO
36+
# Website
37+
38+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
39+
40+
## Installation
41+
42+
```bash
43+
yarn
44+
```
45+
46+
## Local Development
47+
48+
```bash
49+
yarn start
50+
```
51+
52+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
53+
54+
## Build
55+
56+
```bash
57+
yarn build
58+
```
59+
60+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
61+
62+
## Deployment
63+
64+
Using SSH:
65+
66+
```bash
67+
USE_SSH=true yarn deploy
68+
```
69+
70+
Not using SSH:
71+
72+
```bash
73+
GIT_USER=<Your GitHub username> yarn deploy
74+
```
75+
76+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3777

3878
---
3979

convert-frontmatter.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const glob = require('glob');
4+
5+
const DOCS_DIR = path.join(__dirname, 'docs');
6+
7+
// Use glob.sync with forward slashes
8+
const files = glob.sync(path.join(DOCS_DIR, '**/*.md').replace(/\\/g, '/'));
9+
10+
console.log(`Found ${files.length} markdown files.`);
11+
12+
files.forEach(file => {
13+
let content = fs.readFileSync(file, 'utf8');
14+
15+
// Match frontmatter (--- at start, then anything, then ---)
16+
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
17+
if (fmMatch) {
18+
let fmContent = fmMatch[1];
19+
20+
// Only add id if not present
21+
if (!/^id:/m.test(fmContent)) {
22+
const titleMatch = fmContent.match(/^\s*title:\s*(.+)$/m);
23+
const titleLine = titleMatch ? `title: ${titleMatch[1]}` : '';
24+
25+
const sidebarMatch = fmContent.match(/^\s*sidebar_position:\s*(.+)$/m);
26+
const sidebarLine = sidebarMatch ? `sidebar_position: ${sidebarMatch[1]}` : '';
27+
28+
// Generate ID from filename (kebab-case)
29+
const id = path.basename(file, path.extname(file))
30+
.trim()
31+
.toLowerCase()
32+
.replace(/\s+/g, '-');
33+
34+
const newFM = ['---', `id: ${id}`, sidebarLine, titleLine, '---']
35+
.filter(Boolean)
36+
.join('\n');
37+
38+
const restContent = content.slice(fmMatch[0].length).trimStart();
39+
fs.writeFileSync(file, newFM + '\n\n' + restContent, 'utf8');
40+
41+
console.log(`Updated frontmatter: ${file}`);
42+
}
43+
} else {
44+
// No frontmatter at all
45+
const id = path.basename(file, path.extname(file))
46+
.trim()
47+
.toLowerCase()
48+
.replace(/\s+/g, '-');
49+
const title = id.replace(/-/g, ' ');
50+
51+
const newFM = `---
52+
id: ${id}
53+
title: ${title}
54+
---`;
55+
56+
fs.writeFileSync(file, newFM + '\n\n' + content, 'utf8');
57+
console.log(`Added frontmatter: ${file}`);
58+
}
59+
});
60+
61+
console.log('Frontmatter conversion complete.');

0 commit comments

Comments
 (0)