Contribute to the documentation
Use this guide to change the documentation website. It assumes you have a pg-proxy checkout, Node.js 22 or newer, and npm available.
1. Install the site dependencies
Section titled “1. Install the site dependencies”From the repository root:
cd docs/sitenpm ciThe site is a standalone npm project with its own lockfile.
2. Choose the page type
Section titled “2. Choose the page type”Follow the Divio documentation system:
Directory under src/content/docs |
Purpose |
|---|---|
tutorials/ (deferred) |
Guide a learner through a fixed exercise with expected results. |
how-to/ |
Help an experienced reader complete a specific task. |
reference/ |
Describe settings, interfaces, defaults, and constraints. |
explanation/ |
Explain concepts, design choices, and tradeoffs. |
Choose one purpose per page and link to other types when needed.
3. Edit or add Markdown
Section titled “3. Edit or add Markdown”Start a new page with:
---title: "A specific page title"description: "What the reader will learn or accomplish."---When the page is ready to publish, add it to the relevant sidebar group in astro.config.mjs and to src/content/docs/index.md. A file at how-to/local-development.md has slug how-to/local-development and URL /how-to/local-development/.
For unfinished pages, add draft: true to the frontmatter. View the draft at its URL with the development server; production builds and search exclude it. Keep it out of the explicit sidebar and published page links until the draft flag is removed.
Link to other pages by their Markdown file with a relative path, such as ../how-to/local-development.md from explanation/pooling.md. The link then works on GitHub, and the build rewrites it to a relative site URL so the site works at any path prefix. The build fails on site-style links such as ../../how-to/local-development/. Link to repository files with full https://github.com/DataDog/pg-proxy/blob/main/... URLs.
Sidebar page entries use { slug: "path/to/page" } so their labels match the page title. Set the title in the page frontmatter rather than adding a separate navigation label.
Use block-style YAML mappings and lists in examples: put each mapping entry or
list item on its own line instead of using inline collections. Empty {} and []
are allowed because YAML needs them to represent empty collections. Run go test -run '^TestDocumentationYAMLStyle$' . from the repository
root to check YAML examples in Markdown and YAML files under docs/, examples/,
pkg/, and cmd/, plus Markdown files in the repository root.
Keep the homepage as an index. Put appearance changes in src/styles/custom.css. Use ordinary Markdown for content.
4. Preview edits
Section titled “4. Preview edits”npm run dev -- --host 127.0.0.1 --port 4321 --backgroundOpen the local address printed by Astro. Check the page, navigation, and links. If another server already uses port 4321, choose an unused port or stop the server you started.
5. Validate the production output
Section titled “5. Validate the production output”Stop the development server before reusing its port:
npm run astro -- dev stopnpm run buildnpm run preview -- --host 127.0.0.1 --port 4321Check search in the production preview because its index is generated during the build. A successful site build checks rendering, not whether proxy commands work; verify executable examples separately.
To produce a self-contained static site and check every local link, anchor, redirect, and asset, run:
npm run build:static6. Prepare the change
Section titled “6. Prepare the change”Include Markdown, navigation, and any necessary redirects. When moving a page, update inbound links and add its old URL to redirects in astro.config.mjs. Keep dist/, dist-static/, .astro/, and node_modules/ out of Git.
7. Publish the static site
Section titled “7. Publish the static site”npm run build:static writes plain HTML to dist-static/. Directory links point at explicit index.html files, so the output works on hosts without directory-index routing, and the search index is rebuilt to match. To host the site below a path prefix, pass the prefix:
npm run build:static -- /pg-proxy/Upload the contents of dist-static/ with index.html at the site root. Rebuild when changing the prefix; it is part of the generated URLs.
