From 100f49a8cf2894aaae0ad0c6cf83bb2442830c61 Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:37:48 +0200 Subject: [PATCH 1/9] fix(docs): resolve relative links against the page's folder, and check every link after the build Pages kept Docusaurus-style relative links (../versioning, ./panel/install). With trailingSlash the browser resolved them one folder too deep, so about 50 links on 13 pages went to 404s. lib/docs-href.ts resolves them at build time for the HTML pages and the .md copies alike, and scripts/check-links.mjs (postbuild, check:links) fails the build on any docs link to a page, file or #anchor that isn't there. --- .github/workflows/build.yml | 2 +- .github/workflows/publish-docs.yml | 2 +- AGENTS.md | 2 +- README.md | 2 +- app/docs/[[...slug]]/page.tsx | 10 ++- lib/docs-href.test.mjs | 31 +++++++ lib/docs-href.ts | 33 +++++++ lib/llms.ts | 12 +-- package.json | 3 +- scripts/README.md | 3 +- scripts/check-links.mjs | 140 +++++++++++++++++++++++++++++ scripts/check-links.test.mjs | 101 +++++++++++++++++++++ 12 files changed, 324 insertions(+), 17 deletions(-) create mode 100644 lib/docs-href.test.mjs create mode 100644 lib/docs-href.ts create mode 100644 scripts/check-links.mjs create mode 100644 scripts/check-links.test.mjs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 418e8f88..b57faddf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,6 +46,6 @@ jobs: run: bun run typecheck # prebuild runs check:content again (Netlify builds run it there); - # postbuild runs check:paths on out/. + # postbuild runs check:paths and check:links on out/. - name: 'Build' run: bun run build diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 0d15d911..6c970928 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -58,7 +58,7 @@ jobs: - name: 'Typecheck' run: bun run typecheck - # prebuild checks the content, postbuild checks every file lands where it should. + # prebuild checks the content, postbuild checks every file lands where it should and every link works. - name: 'Build' run: bun run build diff --git a/AGENTS.md b/AGENTS.md index cb862b67..add8a264 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,7 +19,7 @@ This block is written and re-added by `next dev` — verify at `node_modules/nex - Before opening a pull request: `bun test`, `bun run typecheck`, `bun run build`. The build checks the pages before it (`check:content`), refreshes the egg data (`sync:eggs`, which uses the network and rewrites `data/eggs.json`, `public/data/eggs/`, `public/img/eggs/`, `public/img/games/`: don't - commit those unless the task is about eggs), and checks the paths after it (`check:paths`). + commit those unless the task is about eggs), and checks the paths and the links after it (`check:paths`, `check:links`). - The paths this build serves on pelican.dev are in one file, `router/paths.mjs`. Change them there, and in the Hub's `DocsBuildService::ROOT_FILES` for the root files. - A new MDX component goes in `mdx-components.tsx` and in `COMPONENTS` in diff --git a/README.md b/README.md index 6189c547..72615e46 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ You need Node.js 22 or newer (Next.js builds on Node) and [Bun](https://bun.com) ```sh bun install bun run dev # http://localhost:3000, reloads as you edit -bun run build # the production site, written to out/ (checks the pages first, the paths after) +bun run build # the production site, written to out/ (checks the pages first, the paths and links after) bun test # the tests for scripts/ and router/ ``` diff --git a/app/docs/[[...slug]]/page.tsx b/app/docs/[[...slug]]/page.tsx index 77047dce..27c2fff3 100644 --- a/app/docs/[[...slug]]/page.tsx +++ b/app/docs/[[...slug]]/page.tsx @@ -6,7 +6,7 @@ import { EditOnGitHub, PageLastUpdate, } from 'fumadocs-ui/layouts/docs/page'; -import { createRelativeLink } from 'fumadocs-ui/mdx'; +import defaultMdxComponents from 'fumadocs-ui/mdx'; import { getBreadcrumbItems } from 'fumadocs-core/breadcrumb'; import { notFound } from 'next/navigation'; import type { Metadata } from 'next'; @@ -15,6 +15,7 @@ import { docsBreadcrumbJsonLd, jsonLdScript, ogImage, pageMetadata, techArticleJ import { getMDXComponents } from '@/mdx-components'; import { PageActions } from '@/components/docs/page-actions'; import { markdownPath } from '@/lib/llms'; +import { resolveDocsHref } from '@/lib/docs-href'; export const dynamicParams = false; @@ -55,8 +56,11 @@ export default async function Page(props: PageProps<'/docs/[[...slug]]'>) { ( + + ), })} /> diff --git a/lib/docs-href.test.mjs b/lib/docs-href.test.mjs new file mode 100644 index 00000000..3f8d2e2f --- /dev/null +++ b/lib/docs-href.test.mjs @@ -0,0 +1,31 @@ +// bun test lib/docs-href.test.mjs +// Relative links in a page resolve against the page's folder, not one folder deeper (trailingSlash). +import { expect, test } from 'bun:test'; +import { resolveDocsHref } from './docs-href.ts'; + +test('relative links resolve against the page file\'s folder', () => { + expect(resolveDocsHref('../versioning', 'panel/update.mdx')).toBe('/docs/versioning/'); + expect(resolveDocsHref('./install#docker-compose', 'panel/update.mdx')).toBe('/docs/panel/install/#docker-compose'); + expect(resolveDocsHref('./panel/install', 'getting-started.mdx')).toBe('/docs/panel/install/'); + expect(resolveDocsHref('../../guides/troubleshooting#schedules-not-running', 'panel/advanced/plugins.mdx')).toBe( + '/docs/guides/troubleshooting/#schedules-not-running', + ); + expect(resolveDocsHref('./contributors', 'index.mdx')).toBe('/docs/contributors/'); +}); + +test('links to .mdx files and folder index files become page paths', () => { + expect(resolveDocsHref('./guides/migrating-from-pterodactyl.mdx', 'comparison.mdx')).toBe('/docs/guides/migrating-from-pterodactyl/'); + expect(resolveDocsHref('./disk-quotas/index.mdx', 'guides/ssl.mdx')).toBe('/docs/guides/disk-quotas/'); +}); + +test('/docs paths get the trailing slash; files keep their name', () => { + expect(resolveDocsHref('/docs/guides/disk-quotas/about', 'x.mdx')).toBe('/docs/guides/disk-quotas/about/'); + expect(resolveDocsHref('/docs/panel/update.md', 'x.mdx')).toBe('/docs/panel/update.md'); + expect(resolveDocsHref('/docs', 'x.mdx')).toBe('/docs/'); +}); + +test('other sites, anchors and the Hub\'s paths are left alone', () => { + for (const href of ['https://github.com/pelican/panel', '#glossary', 'mailto:a@b.c', '/eggs', '/plugins', '//cdn.example.com/x', '/install.sh']) { + expect(resolveDocsHref(href, 'panel/update.mdx')).toBe(href); + } +}); diff --git a/lib/docs-href.ts b/lib/docs-href.ts new file mode 100644 index 00000000..23d7cd70 --- /dev/null +++ b/lib/docs-href.ts @@ -0,0 +1,33 @@ +/** + * Where a link written in a docs page goes, as a site path. + * + * Pages keep the Docusaurus habit of relative links (`../versioning`, `./panel/install`, + * `./docker.mdx`). They mean "next to this file", but the site has trailing slashes + * (next.config.mjs), so a browser would resolve them one folder too deep: + * `../versioning` on /docs/panel/update/ is /docs/panel/versioning/, which doesn't exist. + * So they are resolved here, at build time, against the page's folder: the HTML page + * (app/docs/[[...slug]]/page.tsx) and its Markdown copy (lib/llms.ts) both use this. + * scripts/check-links.mjs then checks every link in the build. + */ + +/** + * `href` as written in the page whose file is `pagePath` (relative to content/docs, like + * `panel/update.mdx`) → the path it points at: `/docs/versioning/`, `/docs/panel/install/#docker-compose`. + * Other sites, `#anchors`, `mailto:` and root paths outside /docs (the Hub's /plugins, /eggs) + * come back unchanged; /docs paths get the trailing slash the site uses. + */ +export function resolveDocsHref(href: string, pagePath: string): string { + if (!href || href.startsWith('#') || href.startsWith('?') || href.startsWith('//') || /^[a-z][a-z\d+.-]*:/i.test(href)) { + return href; + } + const relative = !href.startsWith('/'); + if (!relative && !/^\/docs(\/|$|[?#])/.test(href)) return href; + + // The page's folder on the site: /docs/panel/ for panel/update.mdx, /docs/ for index.mdx. + const dir = `/docs/${pagePath.split('/').slice(0, -1).join('/')}`.replace(/\/?$/, '/'); + const url = new URL(href, `https://x${dir}`); + let path = url.pathname; + if (relative) path = path.replace(/\.mdx?$/, '').replace(/\/index$/, '/'); + if (!path.endsWith('/') && !/\.[a-z\d]+$/i.test(path)) path += '/'; + return `${path}${url.search}${url.hash}`; +} diff --git a/lib/llms.ts b/lib/llms.ts index df616825..f11ad247 100644 --- a/lib/llms.ts +++ b/lib/llms.ts @@ -1,5 +1,6 @@ import { renderPlaceholder, type PlaceholderData } from 'fumadocs-core/mdx-plugins/remark-llms.runtime'; import type { Node } from 'fumadocs-core/page-tree'; +import { resolveDocsHref } from '@/lib/docs-href'; import { project } from '@/lib/home-data'; import { source } from '@/lib/source'; @@ -245,16 +246,11 @@ function cleanFenceMeta(markdown: string): string { }); } -/** Relative and root links → absolute pelican.dev URLs, resolved like the HTML page does. */ +/** Relative and root links → absolute pelican.dev URLs, resolved like the HTML page does (lib/docs-href.ts). */ function absoluteLinks(markdown: string, page: DocsPage): string { - // The page's folder on the site, e.g. /docs/panel/ for panel/getting-started.mdx. - const dir = `/docs/${page.path.split('/').slice(0, -1).join('/')}`.replace(/\/?$/, '/'); return markdown.replace(/\]\((?!https?:|mailto:|#)([^)\s]+)\)/g, (_, href: string) => { - const [path, hash] = href.split('#'); - let url = path.startsWith('/') ? path : new URL(path, `https://x${dir}`).pathname; - url = url.replace(/\.mdx?$/, '').replace(/\/index$/, ''); - if (!/\.[a-z0-9]+$/i.test(url) && !url.endsWith('/')) url += '/'; - return `](${SITE_URL}${url}${hash ? `#${hash}` : ''})`; + const url = resolveDocsHref(href, page.path); + return `](${url.startsWith('/') ? SITE_URL : ''}${url})`; }); } diff --git a/package.json b/package.json index ef55adc4..776b61be 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,12 @@ "dev:site": "bun router/dev-server.mjs", "build": "next build", "prebuild": "bun scripts/check-content.mjs && bun scripts/sync-eggs.mjs --if-online", - "postbuild": "bun scripts/check-paths.mjs", + "postbuild": "bun scripts/check-paths.mjs && bun scripts/check-links.mjs", "test": "bun test", "typecheck": "fumadocs-mdx && next typegen && tsc --noEmit", "check:content": "bun scripts/check-content.mjs", "check:paths": "bun scripts/check-paths.mjs", + "check:links": "bun scripts/check-links.mjs", "sync:eggs": "bun scripts/sync-eggs.mjs", "pack:docs": "bun scripts/pack-docs.mjs", "postinstall": "fumadocs-mdx" diff --git a/scripts/README.md b/scripts/README.md index 09570d74..aaa9ee2f 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -28,6 +28,7 @@ run and change one without reading the others first: | `check-content.mjs` | Fails if a page in `content/` could run code (MDX compiles pages to JavaScript) | Before every build, and in CI | `bun run check:content` | `check-content.test.mjs` | | `sync-eggs.mjs` | Refreshes the egg data for the interim `/eggs` page and the homepage games strip. Uses the network and rewrites `data/eggs.json`, `public/data/eggs/`, `public/img/eggs/` and `public/img/games/` | Before every build (`--if-online`: no network keeps the saved data; a bug still fails); by hand | `bun run sync:eggs` | `sync-eggs.test.mjs` | | `check-paths.mjs` | Fails if the build puts a file where pelican.dev won't serve it from this build, misses a root file, or a docs page loads something from outside `/docs/` | After every build, and in CI | `bun run check:paths` | `check-paths.test.mjs` | +| `check-links.mjs` | Fails if a link on a docs page goes to a docs page, file or `#anchor` that isn't in the build (links to the Hub and other sites aren't checked) | After every build, and in CI | `bun run check:links` | `check-links.test.mjs` | | `pack-docs.mjs` | Packs `out/` into the folder the Hub serves on pelican.dev (docs, root files, 404 page, redirects) | Before every publish, in CI ("Publish docs build"); by hand to look at the result | `bun run pack:docs` | `pack-docs.test.mjs` | | `../public/install.sh` | pelican.dev/install.sh: installs Docker, a one-node Swarm, Traefik (Let's Encrypt) and the Panel, optionally Wings. A bash script for servers, not a Bun one; the tests run it in `--dry-run` | Run by people on their servers (`curl … \| sudo bash`) | `bash public/install.sh --dry-run --help` | `install-sh.test.mjs` | | `../router/paths.mjs` | Which paths are this build's: `/docs/*` and the root files | Imported by the scripts above and the router | (nothing to run) | `router/paths.test.mjs` | @@ -35,7 +36,7 @@ run and change one without reading the others first: | `../router/worker.mjs` | The Cloudflare Worker option for later (not deployed) | Not deployed | see `router/README.md` | `router/worker.test.mjs` | `bun run build` runs the checks around Next.js: `prebuild` runs `check-content` and `sync-eggs` -(`--if-online`), and `postbuild` runs `check-paths`. +(`--if-online`), and `postbuild` runs `check-paths` and `check-links`. **The build changes tracked files.** `sync-eggs` refreshes the egg data, so after `bun run build` you may see changes in `data/eggs.json`, `public/data/eggs/`, `public/img/eggs/` and `public/img/games/`. Commit diff --git a/scripts/check-links.mjs b/scripts/check-links.mjs new file mode 100644 index 00000000..839bdc26 --- /dev/null +++ b/scripts/check-links.mjs @@ -0,0 +1,140 @@ +#!/usr/bin/env bun +/** + * Checks that every link on a docs page goes to a page (and #anchor) that exists. + * + * When: after every build (postbuild, after check-paths), and in CI + * Run: bun run check:links (or: bun scripts/check-links.mjs [outDir], default out/) + * Tests: bun test scripts/check-links.test.mjs + * + * It reads every out/docs/**\/*.html and each in it, resolves the href the way the + * browser does (against the page's own URL, which ends in "/" because of trailingSlash), and + * fails when a link to this build's paths (router/paths.mjs: /docs/* and the root files): + * - goes to a page or file that isn't in out/ and isn't an old path netlify.toml redirects; + * - has an #anchor that the target page has no id for (same-page "#x" links included). + * Links to the Hub's pages (/plugins, /eggs, …) and to other sites aren't checked. + */ +import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'; +import { join, relative, sep } from 'node:path'; +import { isDocsPath } from '../router/paths.mjs'; +import { docsRedirects } from './pack-docs.mjs'; + +const ORIGIN = 'https://pelican.dev'; + +/** The URL a built HTML file is served at: docs/panel/update/index.html -> /docs/panel/update/ */ +export function pagePathOf(file) { + return `/${file.replace(/index\.html$/, '').replace(/\.html$/, '/')}`; +} + +/** `&` and friends in an attribute value, as the browser reads them. */ +function unescapeHtml(value) { + return value + .replace(/"/g, '"') + .replace(/'|'/g, "'") + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/&/g, '&'); +} + +/** The href of every in a page (double-quoted, which is what Next.js writes). */ +export function linksIn(html) { + const hrefs = []; + for (const [tag] of html.matchAll(/]*>/g)) { + const href = /\shref="([^"]*)"/.exec(tag)?.[1]; + if (href !== undefined) hrefs.push(unescapeHtml(href)); + } + return hrefs; +} + +/** Every id in a page: the targets #anchors can jump to. */ +export function idsIn(html) { + const ids = new Set(); + for (const [, id] of html.matchAll(/\sid="([^"]+)"/g)) ids.add(unescapeHtml(id)); + return ids; +} + +/** + * The broken links in a build. `pages` maps each docs page's path (/docs/x/) to its HTML, + * `files` is every file in out/ (relative, "/" separators) and `redirects` the paths + * netlify.toml redirects (without a trailing slash). Returns `{ page, href, reason }`s. + */ +export function brokenLinks(pages, files, redirects = new Set()) { + const fileSet = new Set(files); + const idCache = new Map(); + const idsOf = (path) => { + if (!idCache.has(path)) idCache.set(path, idsIn(pages.get(path) ?? '')); + return idCache.get(path); + }; + + const broken = []; + for (const [page, html] of pages) { + for (const href of linksIn(html)) { + if (!href || /^(mailto|tel):/.test(href)) continue; + let url; + try { + url = new URL(href, `${ORIGIN}${page}`); + } catch { + broken.push({ page, href, reason: 'not a valid URL' }); + continue; + } + if (url.origin !== ORIGIN || !isDocsPath(url.pathname)) continue; // another site, or the Hub's + + const path = url.pathname; + const hash = url.hash ? decodeURIComponent(url.hash.slice(1)) : ''; + + let target; // the HTML page the link lands on, if it is one + if (pages.has(path)) target = path; + else if (pages.has(`${path}/`)) target = `${path}/`; // served with a 301 to the slash + else if (fileSet.has(path.slice(1))) target = undefined; // a file: .md, .txt, .sh, an image + else if (path.endsWith('.md') && fileSet.has(`docs/md/${path.slice('/docs/'.length)}`)) target = undefined; + else if (redirects.has(path.replace(/\/$/, ''))) continue; // an old path netlify.toml redirects + else { + broken.push({ page, href, reason: 'no such page' }); + continue; + } + + if (hash && target && !idsOf(target).has(hash)) broken.push({ page, href, reason: `no #${hash} on ${target}` }); + } + } + return broken; +} + +function walk(dir) { + return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => { + const path = join(dir, entry.name); + return entry.isDirectory() ? walk(path) : [path]; + }); +} + +/** Runs the check on a built `outDir`: how many docs pages it read, and the broken links. */ +export function checkLinks(outDir, toml = 'netlify.toml') { + const files = walk(outDir).map((file) => relative(outDir, file).split(sep).join('/')); + const pages = new Map(); + for (const file of files.filter((f) => f.startsWith('docs/') && f.endsWith('.html'))) { + pages.set(pagePathOf(file), readFileSync(join(outDir, file), 'utf8')); + } + const redirects = new Set( + existsSync(toml) ? docsRedirects(readFileSync(toml, 'utf8')).map(({ from }) => from.replace(/\/$/, '')) : [], + ); + return { pages: pages.size, broken: brokenLinks(pages, files, redirects) }; +} + +function main(outDir) { + try { + statSync(outDir); + } catch { + console.error(`check-links: ${outDir}/ not found. Run the build first.`); + process.exit(1); + } + + const { pages, broken } = checkLinks(outDir); + if (broken.length) { + console.error(`check-links: ${broken.length} broken link(s) on the docs pages:`); + for (const { page, href, reason } of broken.slice(0, 100)) console.error(` ${page} ${href} (${reason})`); + if (broken.length > 100) console.error(` … and ${broken.length - 100} more`); + console.error('\nFix the link in content/docs/, or add a redirect for an old path to netlify.toml.'); + process.exit(1); + } + console.log(`check-links: ok (${pages} docs pages)`); +} + +if (import.meta.main) main(process.argv[2] ?? 'out'); diff --git a/scripts/check-links.test.mjs b/scripts/check-links.test.mjs new file mode 100644 index 00000000..ee0901e4 --- /dev/null +++ b/scripts/check-links.test.mjs @@ -0,0 +1,101 @@ +// bun test scripts/check-links.test.mjs (all tests: bun test) +// Which links on the built docs pages count as broken, and that the script fails the build on one. +import { describe, expect, test } from 'bun:test'; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { dirname, join } from 'node:path'; +import { brokenLinks, idsIn, linksIn, pagePathOf } from './check-links.mjs'; + +const page = (body) => `

x

${body}`; + +test('a built file is served at its folder\'s URL', () => { + expect(pagePathOf('docs/index.html')).toBe('/docs/'); + expect(pagePathOf('docs/panel/update/index.html')).toBe('/docs/panel/update/'); +}); + +test('reads hrefs and ids from the HTML', () => { + const html = '
Ano href

C

'; + expect(linksIn(html)).toEqual(['../a/?q=1&r=2#b']); + expect([...idsIn(html)]).toEqual(['c&d']); +}); + +describe('brokenLinks', () => { + const pages = new Map([ + ['/docs/', page('okok')], + ['/docs/panel/update/', page('

Docker

ok')], + ]); + const files = ['docs/index.html', 'docs/panel/update/index.html', 'docs/md/panel/update.md', 'llms.txt']; + + test('working links pass: pages, anchors, files, Markdown, the Hub and other sites', () => { + const html = page( + [ + 'a', + 'no slash: a 301', + 'markdown', + 'root file', + 'the Hub', + 'another site', + 'mail', + 'old path, redirected', + ].join(''), + ); + const all = new Map([...pages, ['/docs/x/', html]]); + expect(brokenLinks(all, [...files, 'docs/x/index.html'], new Set(['/docs/about']))).toEqual([]); + }); + + test('a relative link resolved one folder too deep is broken', () => { + // content/docs/panel/update.mdx wrote [Versioning](../versioning); on /docs/panel/update/ + // the browser makes that /docs/panel/versioning/. + const all = new Map([...pages, ['/docs/panel/update/', page('

D

Versioning')]]); + expect(brokenLinks(all, files)).toEqual([{ page: '/docs/panel/update/', href: '../versioning', reason: 'no such page' }]); + }); + + test('a missing #anchor is broken, on another page or the same one', () => { + const all = new Map([...pages, ['/docs/x/', page('ab')]]); + expect(brokenLinks(all, files)).toEqual([ + { page: '/docs/x/', href: '/docs/panel/update/#nope', reason: 'no #nope on /docs/panel/update/' }, + { page: '/docs/x/', href: '#gone', reason: 'no #gone on /docs/x/' }, + ]); + }); +}); + +describe('the script', () => { + function build(pagesByFile) { + const dir = mkdtempSync(join(tmpdir(), 'check-links-')); + for (const [file, html] of Object.entries(pagesByFile)) { + mkdirSync(dirname(join(dir, file)), { recursive: true }); + writeFileSync(join(dir, file), html); + } + return dir; + } + const run = (dir) => Bun.spawnSync(['bun', join(import.meta.dir, 'check-links.mjs'), dir], { cwd: dir }); + + test('passes a build whose links all work', () => { + const dir = build({ + 'docs/index.html': page('Versioning'), + 'docs/versioning/index.html': page(''), + }); + try { + const result = run(dir); + expect(result.exitCode).toBe(0); + expect(result.stdout.toString()).toContain('check-links: ok (2 docs pages)'); + } finally { + rmSync(dir, { recursive: true, force: true }); + } + }); + + test('fails a build with a broken link, naming the page and the link', () => { + const dir = build({ + 'docs/index.html': page(''), + 'docs/versioning/index.html': page(''), + 'docs/panel/update/index.html': page('Versioning'), + }); + try { + const result = run(dir); + expect(result.exitCode).toBe(1); + expect(result.stderr.toString()).toContain('/docs/panel/update/ ../versioning (no such page)'); + } finally { + rmSync(dir, { recursive: true, force: true }); + } + }); +}); From f305d69bed372bdc4b7d2075ee95f38afff2cde6 Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:37:49 +0200 Subject: [PATCH 2/9] ci: fetch the whole history so each page gets its own last-modified date The last-modified plugin reads git. With a depth-1 checkout every page got the date of the latest commit in the sitemap, article:modified_time, JSON-LD and "Last updated". --- .github/workflows/build.yml | 4 ++++ .github/workflows/publish-docs.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b57faddf..092fcc11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,10 @@ jobs: steps: - name: 'Checkout' uses: actions/checkout@v7 + with: + # The whole history: each page's "Last updated", sitemap date and JSON-LD dates come + # from git (lastModified in source.config.ts). A shallow clone gives every page the same date. + fetch-depth: 0 # Bun installs and runs the scripts; Next.js itself still builds on Node. - name: 'Setup Bun' diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 6c970928..76cc3575 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -30,6 +30,10 @@ jobs: steps: - name: 'Checkout' uses: actions/checkout@v7 + with: + # The whole history: each page's "Last updated", sitemap date and JSON-LD dates come + # from git (lastModified in source.config.ts). A shallow clone gives every page the same date. + fetch-depth: 0 - name: 'Setup Bun' uses: oven-sh/setup-bun@v2 From 68e9dc7876ce84e8c54b43eee5bbfdbafe75fa19 Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:39:39 +0200 Subject: [PATCH 3/9] docs: open pages with a plain sentence, fix heading levels, clearer titles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pages that started with a heading or a warning box now say what they are for in one or two sentences (facts already in the docs). Headings under the title start at H2 (index, contributors, standalone install pages, SSL tabs). Vague titles say what and for which part: "Using Redis with the Panel", "Advanced Wings Configuration", … (URLs unchanged). Short descriptions for Podman, the webserver config and Cloudflare Tunnel are longer. --- content/docs/comparison.mdx | 2 +- content/docs/contributors.mdx | 8 +++--- content/docs/eggs/creating-a-custom-egg.mdx | 2 ++ content/docs/eggs/creating-a-custom-yolk.mdx | 2 ++ content/docs/guides/change-panel-domain.mdx | 2 ++ content/docs/guides/disk-quotas/about.mdx | 2 ++ content/docs/guides/ssl.mdx | 26 +++++++++---------- content/docs/guides/troubleshooting.mdx | 2 ++ content/docs/index.mdx | 12 +++++---- content/docs/panel/advanced/api-docs.mdx | 2 +- content/docs/panel/advanced/artisan.mdx | 4 ++- .../docs/panel/advanced/cloudflare-tunnel.mdx | 2 +- content/docs/panel/advanced/mysql.mdx | 4 ++- content/docs/panel/advanced/plugins.mdx | 2 +- content/docs/panel/advanced/podman.mdx | 2 +- content/docs/panel/advanced/redis.mdx | 4 ++- .../docs/panel/standalone/getting-started.mdx | 8 +++--- .../docs/panel/standalone/optional-config.mdx | 4 ++- content/docs/panel/standalone/panel-setup.mdx | 4 +-- .../panel/standalone/webserver-config.mdx | 2 +- content/docs/panel/update.mdx | 2 +- content/docs/wings/install.mdx | 2 ++ content/docs/wings/optional-config.mdx | 4 ++- 23 files changed, 65 insertions(+), 39 deletions(-) diff --git a/content/docs/comparison.mdx b/content/docs/comparison.mdx index 1d2c9b14..182a5269 100644 --- a/content/docs/comparison.mdx +++ b/content/docs/comparison.mdx @@ -1,5 +1,5 @@ --- -title: "Comparison" +title: "Pelican vs Pterodactyl and other game server panels" description: "Compare Pelican with Pterodactyl and other game server panels such as PufferPanel, Crafty Controller, TCAdmin, AMP and Calagopus." --- diff --git a/content/docs/contributors.mdx b/content/docs/contributors.mdx index eaccfd80..bf42b3c6 100644 --- a/content/docs/contributors.mdx +++ b/content/docs/contributors.mdx @@ -3,7 +3,9 @@ title: "Contributors" description: "Meet the Pelican core team and community staff, with their GitHub profiles, Discord usernames and roles in the project." --- -### Core Team +Pelican is built by a core team and community staff. This page lists who they are, their Discord usernames and what each of them works on. + +## Core Team | Name | Discord | Role | |--------------------------------------------------------|-----------------|-----------------------------| @@ -15,7 +17,7 @@ description: "Meet the Pelican core team and community staff, with their GitHub Core members of Pelican have a light blue username in Discord. -### Community Staff +## Community Staff | Name | Discord | Role | |---------------------------------------------------------|---------------|---------------| @@ -25,6 +27,6 @@ Core members of Pelican have a light blue username in Discord. Community Staff have a darker blue username in Discord. -### Powered by +## Powered by [![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSource) diff --git a/content/docs/eggs/creating-a-custom-egg.mdx b/content/docs/eggs/creating-a-custom-egg.mdx index a193dcb8..ea9f350c 100644 --- a/content/docs/eggs/creating-a-custom-egg.mdx +++ b/content/docs/eggs/creating-a-custom-egg.mdx @@ -3,6 +3,8 @@ title: "Creating a Custom Egg" description: "Create a custom egg in the Pelican admin panel: startup commands, Docker images, process management, egg variables and the install script." --- +An egg tells Pelican how to install, start and stop one game or app. This page walks through each field when you create an egg in the Admin Panel: startup commands, Docker images, process management, variables and the install script. + ## Create New Egg Navigate to the Admin Panel and click the eggs option in the sidebar then select `New Egg` button. diff --git a/content/docs/eggs/creating-a-custom-yolk.mdx b/content/docs/eggs/creating-a-custom-yolk.mdx index d6e58ed4..c32a49c0 100644 --- a/content/docs/eggs/creating-a-custom-yolk.mdx +++ b/content/docs/eggs/creating-a-custom-yolk.mdx @@ -3,6 +3,8 @@ title: "Creating a Custom Yolk" description: "Build a custom yolk, a Docker image for Pelican eggs, by writing the Dockerfile and entrypoint script that Wings uses to start servers." --- +A yolk is the Docker image an egg runs in. This page builds one: the Dockerfile and the entrypoint script that Wings uses to start a server. + :::warning This tutorial uses examples from our [`ghcr.io/pelican-eggs/yolks:java_8`](https://github.com/pelican-eggs/yolks) docker image, which can be found on GitHub. This tutorial also assumes some knowledge of [Docker](https://docker.io/), we suggest reading up if this all looks foreign to you. ::: diff --git a/content/docs/guides/change-panel-domain.mdx b/content/docs/guides/change-panel-domain.mdx index c1722acd..b30f2bfe 100644 --- a/content/docs/guides/change-panel-domain.mdx +++ b/content/docs/guides/change-panel-domain.mdx @@ -3,6 +3,8 @@ title: "Change Panel Domain" description: "Move the Pelican Panel to a new domain by updating the webserver config, APP_URL in .env and the remote URL in each node's Wings config." --- +Moving the Panel to a new domain means changing it in three places: your webserver config, `APP_URL` in the Panel's `.env` file, and the remote URL in each node's Wings config. + ## Webserver & Panel First you need to modify the server name in your web server config. diff --git a/content/docs/guides/disk-quotas/about.mdx b/content/docs/guides/disk-quotas/about.mdx index 99e5c75c..b0598ee7 100644 --- a/content/docs/guides/disk-quotas/about.mdx +++ b/content/docs/guides/disk-quotas/about.mdx @@ -3,6 +3,8 @@ title: "About Quotas" description: "Read the warnings and requirements before enabling filesystem disk quotas for Pelican server data, which are still a work in progress." --- +Disk quotas let the filesystem limit how much space each server's files can use. Support for them in Pelican is still a work in progress, so read the notices on this page before you enable them. + As called out in the Wings install docs, it is always recommended to keep the server files on a separate partition. diff --git a/content/docs/guides/ssl.mdx b/content/docs/guides/ssl.mdx index 4f19a629..62c70101 100644 --- a/content/docs/guides/ssl.mdx +++ b/content/docs/guides/ssl.mdx @@ -32,7 +32,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and - ### Creating a Certificate + ## Creating a Certificate After installing certbot, we need to generate a certificate. There are a couple of ways to do that, but the easiest is to use the web server-specific certbot plugin you just installed. @@ -48,7 +48,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and When you are using certbot's Nginx/Apache plugin, you won't need to restart your webserver to have the certificate applied assuming that you've already configured the webservers to use SSL as instructed in the [web server configuration step](../panel/standalone/webserver-config). - ### HTTP challenge + ## HTTP challenge HTTP challenge requires you to expose port 80 for the challenge verification. @@ -70,7 +70,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and - ### DNS challenge + ## DNS challenge DNS challenge requires you to create a new TXT DNS record to verify domain ownership, instead of having to expose port 80. The instructions are displayed when you run the certbot command below. @@ -78,7 +78,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and certbot -d example.com --manual --preferred-challenges dns certonly ``` - ### Auto Renewal + ## Auto Renewal You'll also probably want to configure the automatic renewal of certificates to prevent unexpected certificate expirations. You can open crontab with `sudo crontab -e` and add the line from below to the bottom of it for attempting renewal every day at 23 (11 PM). @@ -94,7 +94,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and 0 23 * * * certbot renew --quiet --deploy-hook "systemctl restart nginx" ``` - ### Troubleshooting + ## Troubleshooting If you get an `Insecure Connection` or SSL/TLS related error when trying to access your panel or wings, the certificate has likely expired. This can be easily fixed by renewing the SSL certificate, although using the command `certbot renew` might not do the job if port 80 is in use, as it'll return errors like: `Error: Attempting to renew cert (domain) from /etc/letsencrypt/renew/domain.conf produced an unexpected error`. @@ -141,14 +141,14 @@ These tutorials briefly cover creating a new SSL certificates for your panel and - ### Obtaining CloudFlare API Key (Legacy) + ## Obtaining CloudFlare API Key (Legacy) After installing acme.sh, we need to fetch a CloudFlare API key. On Cloudfare's website, select your domain, then on the right side, copy your "Zone ID" and "Account ID". Click on "Get your API token", click on "Create Token" > select the template "Edit zone DNS" > select the scope of "Zone Resources" Click on "Continue to summary", copy your token. - ### Creating a Certificate + ## Creating a Certificate Since the configuration file is based on Certbot, we need to create the folder manually. @@ -166,7 +166,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and - ### Obtaining CloudFlare API Key (Modern) + ## Obtaining CloudFlare API Key (Modern) After installing acme.sh, we need to fetch a CloudFlare API key. - Cloudfare's website, click on your profile on the top right. @@ -176,7 +176,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and - Continue to the summery. - Confirm you'd like to create the token. - ### Creating a Certificate + ## Creating a Certificate Since the configuration file is based on Certbot, we need to create the folder manually. @@ -199,7 +199,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and This is for advanced users, who are running Cloudflare in proxy mode or do not have access to port `80`. - ### Installing Caddy with Cloudflare DNS plugin + ## Installing Caddy with Cloudflare DNS plugin Caddy does not come by default with Cloudflare DNS plugin, you need to install it yourself. @@ -209,11 +209,11 @@ These tutorials briefly cover creating a new SSL certificates for your panel and 2. Downloading prebuilt binary from [Caddy's download page](https://caddyserver.com/download). 3. Using Ansible to download and install Caddy with plugins. See [caddy-ansible](https://github.com/caddy-ansible/caddy-ansible) - #### Build Caddy using `xcaddy` on your server + ### Build Caddy using `xcaddy` on your server Please refer to [Caddy docs on building Caddy](https://caddyserver.com/docs/build#xcaddy). - ### Obtaining CloudFlare API Token + ## Obtaining CloudFlare API Token After installing acme.sh, we need to fetch a CloudFlare API key. Please make sure that a DNS record (A or CNAME record) is pointing to your target node, and set the cloud to grey (bypassing CloudFlare proxy). Then go to My Profile > API keys and on Global API Key subtab, click on "view", enter your CloudFlare password, and copy the API key to clipboard. @@ -223,7 +223,7 @@ These tutorials briefly cover creating a new SSL certificates for your panel and Create API Token > API token templates, at the end of line with "Edit zone DNS", click "Use template". Under **Zone Resources**, select your DNS zone for which you wish to create the API token, click "Continue to summary". Review the API token summary and click "Create Token". Finally copy the API token to clipboard. - ### Reconfiguring Caddy to use Cloudflare DNS for obtaining certificates + ## Reconfiguring Caddy to use Cloudflare DNS for obtaining certificates Create an environment variable file (like `.env`), keep in mind that this file contains secrets and should not be accessed by public. diff --git a/content/docs/guides/troubleshooting.mdx b/content/docs/guides/troubleshooting.mdx index a6e6a507..d651db89 100644 --- a/content/docs/guides/troubleshooting.mdx +++ b/content/docs/guides/troubleshooting.mdx @@ -3,6 +3,8 @@ title: "Troubleshooting" description: "Diagnose common Pelican problems: panel 500 errors and logs, Wings connection issues, schedules not running, file uploads and plugin removal." --- +Start here when something in Pelican doesn't work. This page shows where to find the Panel's logs and how to fix common Panel errors, Wings connection problems, schedules that don't run, failing file uploads and plugins that won't uninstall. + ## Panel errors If you see a `500 | SERVER ERROR` or `An unexpected error was encountered while processing this request` you have to check your panel logs by running the following command. diff --git a/content/docs/index.mdx b/content/docs/index.mdx index 68d76ea5..1f7fa668 100644 --- a/content/docs/index.mdx +++ b/content/docs/index.mdx @@ -3,19 +3,21 @@ title: "Welcome to Pelican!" description: "Introduction to the Pelican Panel and Wings, the service that runs game servers in Docker containers, with a glossary and an example setup." --- -### What is Pelican? +This is the documentation for Pelican: how to install, update and run the Panel and Wings, set up webservers, SSL and eggs, and move over from Pterodactyl. + +## What is Pelican? [**Pelican**](https://github.com/pelican/panel) is a free, open-source server management panel for hosting game servers, software and applications in isolated Docker containers. It started as a fork of [**Pterodactyl**](https://pterodactyl.io/) and has since grown well beyond it. The Panel is the web interface: it shows information about your servers and sends commands to them. -### What is Wings? +## What is Wings? [**Wings**](https://github.com/pelican/wings) is the service that runs on each machine hosting your servers. It handles the Docker containers behind the scenes (creating, starting, stopping and restarting them) on behalf of the Panel. Users never interact with Wings directly. -### Glossary +## Glossary **Panel**: web application that talks to Wings and lets you control your Servers. @@ -35,7 +37,7 @@ It handles the Docker containers behind the scenes (creating, starting, stopping **Yolk**: curated collection of Docker Images provided by Pelican for use with Eggs. -### Example Setup +## Example Setup ```mermaid flowchart TD @@ -52,7 +54,7 @@ flowchart TD W1 ---> C4(Project Zomboid) ``` -### Open Source! +## Open Source! The Panel is released under [AGPLv3](https://www.gnu.org/licenses/agpl-3.0.en.html) and Wings under [MIT](https://opensource.org/license/mit). Anyone can browse the code, contribute improvements, and help identify bugs and security issues on [GitHub](https://github.com/pelican). diff --git a/content/docs/panel/advanced/api-docs.mdx b/content/docs/panel/advanced/api-docs.mdx index bb1332bf..86a07baa 100644 --- a/content/docs/panel/advanced/api-docs.mdx +++ b/content/docs/panel/advanced/api-docs.mdx @@ -1,5 +1,5 @@ --- -title: "API docs" +title: "Panel API documentation" description: "Find the built-in API docs for your Pelican Panel at /docs/api, covering the Application API and the Client API." --- diff --git a/content/docs/panel/advanced/artisan.mdx b/content/docs/panel/advanced/artisan.mdx index 46c3808e..ba67a3cc 100644 --- a/content/docs/panel/advanced/artisan.mdx +++ b/content/docs/panel/advanced/artisan.mdx @@ -3,7 +3,9 @@ title: "Artisan Commands" description: "Reference for Pelican's php artisan commands to manage users, nodes, servers, eggs, plugins, environment settings, migrations and cache." --- -This is very much a WIP! Many Many commands, Layout might change. +Pelican's `php artisan` commands manage the Panel from the command line: users, nodes, servers, eggs, plugins, environment settings, migrations and the cache. Run them from the Panel's directory (`/var/www/pelican` on an install without Docker). + +This list is still a work in progress: there are many commands, and the layout might change. Updated: 01/11/2026 diff --git a/content/docs/panel/advanced/cloudflare-tunnel.mdx b/content/docs/panel/advanced/cloudflare-tunnel.mdx index fc6471c0..0f8730bc 100644 --- a/content/docs/panel/advanced/cloudflare-tunnel.mdx +++ b/content/docs/panel/advanced/cloudflare-tunnel.mdx @@ -1,6 +1,6 @@ --- title: "Cloudflare Tunnel" -description: "Run the Docker panel behind a Cloudflare Tunnel without opening any ports on the host." +description: "Serve the Docker install of the Pelican Panel over HTTPS through a Cloudflare Tunnel, without opening any inbound ports on the host, and keep Wings reachable." --- A [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/) lets you serve the panel over HTTPS without opening any inbound ports on your host. A small `cloudflared` container makes an outbound connection to Cloudflare, and Cloudflare forwards requests for your hostname down that connection to the panel. diff --git a/content/docs/panel/advanced/mysql.mdx b/content/docs/panel/advanced/mysql.mdx index c8269b47..01c99789 100644 --- a/content/docs/panel/advanced/mysql.mdx +++ b/content/docs/panel/advanced/mysql.mdx @@ -1,8 +1,10 @@ --- -title: "MySQL" +title: "Using MySQL or MariaDB with the Panel" description: "Install MariaDB, create a database and user for the Pelican Panel and switch an existing panel from SQLite to MySQL." --- +The Panel uses SQLite unless you choose MySQL or MariaDB. This page installs MariaDB, creates a database and user for the Panel, and shows how to switch a Panel that is already installed from SQLite; on a new install you enter the database details in the web installer instead. + ## Install MariaDB MariaDB is a MySQL fork and the preferred MySQL software. Run the following commands to quickly install it. diff --git a/content/docs/panel/advanced/plugins.mdx b/content/docs/panel/advanced/plugins.mdx index c8682037..1aab072a 100644 --- a/content/docs/panel/advanced/plugins.mdx +++ b/content/docs/panel/advanced/plugins.mdx @@ -1,5 +1,5 @@ --- -title: "Plugins" +title: "Panel Plugins: install, create and publish" description: "Install, update and uninstall Pelican Panel plugins, and create and publish your own with Filament resources, translations, settings and permissions." --- diff --git a/content/docs/panel/advanced/podman.mdx b/content/docs/panel/advanced/podman.mdx index 3dcec383..5f5a446d 100644 --- a/content/docs/panel/advanced/podman.mdx +++ b/content/docs/panel/advanced/podman.mdx @@ -1,6 +1,6 @@ --- title: "Deploying with Podman" -description: "Deploy Pelican Panel using rootless Podman and Quadlets." +description: "Run the Pelican Panel's Docker image with rootless Podman on Fedora, RHEL or Alma/Rocky Linux, using a Quadlet so systemd manages the container." --- This guide runs the panel's [Docker image](../install) with **rootless Podman** on Fedora, RHEL, or Alma/Rocky Linux, using a **Quadlet** so systemd manages the container. Like the Docker guide, it uses SQLite and serves the panel over plain HTTP on port 80. diff --git a/content/docs/panel/advanced/redis.mdx b/content/docs/panel/advanced/redis.mdx index 958bb8e1..28c177a7 100644 --- a/content/docs/panel/advanced/redis.mdx +++ b/content/docs/panel/advanced/redis.mdx @@ -1,8 +1,10 @@ --- -title: "Redis" +title: "Using Redis with the Panel" description: "Install Redis from its official apt repository and switch an existing Pelican Panel to Redis with the p:redis:setup command." --- +Redis can hold the Panel's cache, sessions and queue instead of the default drivers. This page installs Redis and shows how to switch a Panel that is already installed to it; on a new install you enter the Redis details in the web installer instead. + ## Install Redis To install Redis you first need add their repository. diff --git a/content/docs/panel/standalone/getting-started.mdx b/content/docs/panel/standalone/getting-started.mdx index 374c9ed1..888a43b1 100644 --- a/content/docs/panel/standalone/getting-started.mdx +++ b/content/docs/panel/standalone/getting-started.mdx @@ -23,7 +23,7 @@ so please take some time to read through them before asking for help on the foru This guide installs Pelican directly on your server. The recommended method is [Docker](../install), with a one-command install script; use this guide if you'd rather not run the Panel in a container. -### Picking an Operating System (OS) +## Picking an Operating System (OS) Pelican runs on a wide range of operating systems, so pick whichever you are most comfortable using. Note: Other OS's, not listed below, might still work. @@ -52,7 +52,7 @@ This documentation assumes a Debian/Ubuntu based OS with apt as package manager. SQLite support depends on [libsqlite3-0_3.35+](https://pkgs.org/download/libsqlite3-0) being on the host system. "No SQLite Support" means you'll have to build the package from source. -### Dependencies +## Dependencies For the Panel you need to install **PHP `8.5` (recommended) or `8.4`**, with the following **extensions**: `gd`, `mysql`, `mbstring`, `bcmath`, `xml`, `curl`, `zip`, `intl`, `sqlite3` and `fpm`. @@ -67,7 +67,7 @@ Finally, for some commands during the installation you need `curl`, `tar` and `u Please make sure you installed **all** needed dependencies before continuing! -### Create Directories & Downloading Files +## Create Directories & Downloading Files The first step in this process is to create the folder where the panel will live and then move ourselves into that newly created folder. @@ -84,7 +84,7 @@ This is as simple as using `curl` to download the latest release. curl -L https://github.com/pelican/panel/releases/latest/download/panel.tar.gz | sudo tar -xzv ``` -### Install Composer +## Install Composer Next we will set up Composer along with the required dependencies. diff --git a/content/docs/panel/standalone/optional-config.mdx b/content/docs/panel/standalone/optional-config.mdx index 0d0999d3..354cd7a9 100644 --- a/content/docs/panel/standalone/optional-config.mdx +++ b/content/docs/panel/standalone/optional-config.mdx @@ -1,8 +1,10 @@ --- -title: "Optional Configuration" +title: "Optional Panel Configuration" description: "Configure optional Pelican Panel settings: local or S3 backups, reverse proxy setup for NGINX and Cloudflare, captcha and two-factor requirements." --- +The Panel works without any of these settings. This page covers the ones you may want later: where backups are stored (on the node or in S3), running the Panel behind a reverse proxy, captcha, two-factor requirements and health monitoring. + ## Backups Pelican allows users to create backups of their servers. To create backups, a backup storage method has to be configured. diff --git a/content/docs/panel/standalone/panel-setup.mdx b/content/docs/panel/standalone/panel-setup.mdx index 0cac9a5a..dca31985 100644 --- a/content/docs/panel/standalone/panel-setup.mdx +++ b/content/docs/panel/standalone/panel-setup.mdx @@ -17,7 +17,7 @@ sudo php artisan p:environment:setup Store it somewhere safe - not just on your server. If you lose it all encrypted data is irrecoverable -- **even if you have database backups.** -### Setting Permissions +## Setting Permissions The next step in the installation process is to set the correct permissions on the Panel files so that the webserver can use them correctly. @@ -44,7 +44,7 @@ sudo chmod -R 755 storage/* bootstrap/cache/ -### Web-Installer +## Web-Installer Once you've set the proper permissions, continue the Panel install on the web interface. The web installer is located at `/installer` or `/installer`. diff --git a/content/docs/panel/standalone/webserver-config.mdx b/content/docs/panel/standalone/webserver-config.mdx index 2864362e..3ea2dd9d 100644 --- a/content/docs/panel/standalone/webserver-config.mdx +++ b/content/docs/panel/standalone/webserver-config.mdx @@ -1,6 +1,6 @@ --- title: "Webserver Configuration" -description: "Set up NGINX, Apache or Caddy to serve the Pelican Panel." +description: "Set up NGINX, Apache or Caddy to serve the Pelican Panel installed without Docker, with or without SSL, using config files filled in from your domain and PHP version." --- Fill in your setup below. The config files on this page update to match, so you can copy them as they are. diff --git a/content/docs/panel/update.mdx b/content/docs/panel/update.mdx index 9b9fa7c1..3e3e31e3 100644 --- a/content/docs/panel/update.mdx +++ b/content/docs/panel/update.mdx @@ -23,7 +23,7 @@ Please see the chart below for how these versions line up. ## Updating -You have two options for updating: use the automatic update script (recommended) or do the update steps manually. +There are three ways to update, one per tab below: the Docker image (if you installed with Docker), the update script (recommended without Docker) or the manual steps. diff --git a/content/docs/wings/install.mdx b/content/docs/wings/install.mdx index d42e2a54..a386fe95 100644 --- a/content/docs/wings/install.mdx +++ b/content/docs/wings/install.mdx @@ -3,6 +3,8 @@ title: "Installing Wings" description: "Install Wings on a Linux host with Docker, configure it from a node in the Panel and run it as a systemd service." --- +Wings is the service that runs your game servers on each machine (a node), in Docker containers. This page installs Wings on a Linux host, connects it to a node you create in the Panel and keeps it running with systemd. + This software will not work on Windows operating systems. diff --git a/content/docs/wings/optional-config.mdx b/content/docs/wings/optional-config.mdx index d74849d9..b18f749e 100644 --- a/content/docs/wings/optional-config.mdx +++ b/content/docs/wings/optional-config.mdx @@ -1,8 +1,10 @@ --- -title: "Additional Configuration" +title: "Advanced Wings Configuration" description: "Advanced Wings config.yml options: private registries, custom network interfaces, Cloudflare proxy, PID limits, throttles, transfer limits and Podman." --- +Wings reads its settings from `config.yml` on each node. This page lists which settings the Panel manages and the advanced options you can change by hand: private registries, network interfaces, the Cloudflare proxy, PID limits, throttles and limits for backups, transfers and installs. + These are advanced configurations for Wings. You risk breaking Wings and making containers unusable if you misconfigure something. Proceed only if you know what each configuration value does. From 95e782473d685f86444fd3d30d13db0876981234 Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:41:39 +0200 Subject: [PATCH 4/9] fix(llms): llms.txt lists Plugins and the Hub's real URLs; serve /docs/llms.txt too Adds the Plugin Hub, points Support at /sponsor, drops the trailing slash from the Hub's /eggs and /faq, and links the Hub API docs that exist (hub.pelican.dev/docs/api). The phone menu's links to the Hub's pages are plain s, so they keep /sponsor instead of /sponsor/. --- app/docs/llms.txt/route.ts | 8 ++++++++ lib/layout.shared.tsx | 30 +++++++++++++++++++++++------- lib/llms.ts | 9 +++++---- 3 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 app/docs/llms.txt/route.ts diff --git a/app/docs/llms.txt/route.ts b/app/docs/llms.txt/route.ts new file mode 100644 index 00000000..915bd829 --- /dev/null +++ b/app/docs/llms.txt/route.ts @@ -0,0 +1,8 @@ +import { llmsTxt } from '@/lib/llms'; + +// /docs/llms.txt: the same index as /llms.txt, for tools that look for it next to the docs. +export const dynamic = 'force-static'; + +export function GET() { + return new Response(llmsTxt(), { headers: { 'Content-Type': 'text/plain; charset=utf-8' } }); +} diff --git a/lib/layout.shared.tsx b/lib/layout.shared.tsx index 12f81930..c76671b2 100644 --- a/lib/layout.shared.tsx +++ b/lib/layout.shared.tsx @@ -1,4 +1,4 @@ -import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'; +import type { BaseLayoutProps, LinkItemType } from 'fumadocs-ui/layouts/shared'; import { DiscordIcon } from '@/components/icons'; import { links } from '@/lib/links'; import { navOutsideDocs } from '@/lib/nav'; @@ -21,12 +21,11 @@ export function docsOptions(): BaseLayoutProps { }, githubUrl: links.github, links: [ - // The Hub's pages (ui/nav.json). Fumadocs' `external` would open a new tab; without it a - // click tries client-side navigation, gets no payload from the Hub and loads the page normally. - { text: 'Home', url: '/', on: 'menu' }, - ...navOutsideDocs - .filter((item) => item.href.startsWith('/')) - .map((item) => ({ text: item.label, url: item.href, on: 'menu' as const })), + // The Hub's pages (ui/nav.json), as plain links: Fumadocs' link would add the docs' + // trailing slash (/sponsor/ instead of /sponsor) and try client-side navigation, and its + // `external` would open a new tab. + hubMenuLink('Home', '/'), + ...navOutsideDocs.filter((item) => item.href.startsWith('/')).map((item) => hubMenuLink(item.label, item.href)), { type: 'icon', label: 'Discord', @@ -37,3 +36,20 @@ export function docsOptions(): BaseLayoutProps { ], }; } + +/** Fumadocs' own sidebar link look (itemVariants in fumadocs-ui's docs sidebar), for a plain . */ +const MENU_LINK = + 'relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none'; + +/** A link to one of the Hub's pages in the phone menu, with its href exactly as written. */ +function hubMenuLink(text: string, url: string): LinkItemType { + return { + type: 'custom', + on: 'menu', + children: ( + + {text} + + ), + }; +} diff --git a/lib/llms.ts b/lib/llms.ts index f11ad247..1358e0df 100644 --- a/lib/llms.ts +++ b/lib/llms.ts @@ -293,15 +293,16 @@ export function llmsTxt(): string { lines.push( '## Site', '', - `- [Eggs](${SITE_URL}/eggs/): searchable index of community eggs (games and apps Pelican can run)`, - `- [Support Pelican](${SITE_URL}/support/): how to fund the project (monthly plans, one-off donations) or help without paying`, - `- [FAQ](${SITE_URL}/faq/): differences from Pterodactyl, migration, egg compatibility, AGPLv3 licensing and plugins`, + `- [Plugins](${SITE_URL}/plugins): the Plugin Hub, with plugins and themes for the Panel`, + `- [Eggs](${SITE_URL}/eggs): searchable index of community eggs (games and apps Pelican can run)`, + `- [Support Pelican](${SITE_URL}/sponsor): how to fund the project (monthly plans, one-off donations) or help without paying`, + `- [FAQ](${SITE_URL}/faq): differences from Pterodactyl, migration, egg compatibility, AGPLv3 licensing and plugins`, `- [Full docs in one file](${SITE_URL}/llms-full.txt): every page above, in order`, '', '## Optional', '', '- [Source code](https://github.com/pelican/panel): the Panel on GitHub', - '- [Hub API](https://hub.pelican.dev/api): API for the plugin and egg hub', + '- [Hub API](https://hub.pelican.dev/docs/api): API for the plugin and egg hub', '', ); From 21d1e0824685c945f2fd3bd543c5ae140a6d73ac Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:41:39 +0200 Subject: [PATCH 5/9] feat(seo): docs JSON-LD names Pelican as author and publisher, with datePublished; link the Markdown copy TechArticle's author and publisher are the Organization the Hub's home page defines (@id https://pelican.dev/#organization). datePublished is the page's first commit (skipped on a shallow clone). Each page has to its .md. --- app/docs/[[...slug]]/page.tsx | 6 +++++- lib/git-dates.ts | 30 ++++++++++++++++++++++++++++++ lib/og.ts | 12 ++++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 lib/git-dates.ts diff --git a/app/docs/[[...slug]]/page.tsx b/app/docs/[[...slug]]/page.tsx index 27c2fff3..94590721 100644 --- a/app/docs/[[...slug]]/page.tsx +++ b/app/docs/[[...slug]]/page.tsx @@ -14,8 +14,9 @@ import { githubEditUrl, source } from '@/lib/source'; import { docsBreadcrumbJsonLd, jsonLdScript, ogImage, pageMetadata, techArticleJsonLd } from '@/lib/og'; import { getMDXComponents } from '@/mdx-components'; import { PageActions } from '@/components/docs/page-actions'; -import { markdownPath } from '@/lib/llms'; +import { markdownPath, SITE_URL } from '@/lib/llms'; import { resolveDocsHref } from '@/lib/docs-href'; +import { firstCommitDate } from '@/lib/git-dates'; export const dynamicParams = false; @@ -34,6 +35,7 @@ export default async function Page(props: PageProps<'/docs/[[...slug]]'>) { image: ogImage.docs(page.slugs), section: docsSection(page.url), lastModified: page.data.lastModified, + published: firstCommitDate(`content/docs/${page.path}`), }), ); @@ -91,6 +93,8 @@ export async function generateMetadata(props: PageProps<'/docs/[[...slug]]'>): P image: ogImage.docs(page.slugs), type: isIndex ? 'website' : 'article', modifiedTime: page.data.lastModified, + // The page as Markdown, for AI tools (lib/llms.ts). /docs/md/… is the built file behind it. + markdown: `${SITE_URL}${markdownPath(page)}`, }); } diff --git a/lib/git-dates.ts b/lib/git-dates.ts new file mode 100644 index 00000000..70de6997 --- /dev/null +++ b/lib/git-dates.ts @@ -0,0 +1,30 @@ +import { execFileSync } from 'node:child_process'; + +/** + * When a docs page was first committed, from git, for the article's datePublished. Follows + * renames (pages moved from the Docusaurus layout). Undefined when git isn't there or the + * clone is shallow (CI checks out the whole history, see .github/workflows), so a wrong date + * is never published. + */ +let shallow: boolean | undefined; +const cache = new Map(); + +function git(args: string[]): string { + return execFileSync('git', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim(); +} + +export function firstCommitDate(file: string): Date | undefined { + if (cache.has(file)) return cache.get(file); + let date: Date | undefined; + try { + shallow ??= git(['rev-parse', '--is-shallow-repository']) === 'true'; + if (!shallow) { + const oldest = git(['log', '--follow', '--diff-filter=A', '--format=%aI', '--', file]).split('\n').at(-1); + if (oldest) date = new Date(oldest); + } + } catch { + date = undefined; + } + cache.set(file, date); + return date; +} diff --git a/lib/og.ts b/lib/og.ts index 41d991ed..1edbaa2b 100644 --- a/lib/og.ts +++ b/lib/og.ts @@ -52,6 +52,8 @@ interface PageMetadataInput { type?: 'website' | 'article'; /** For articles: when the source last changed. */ modifiedTime?: Date; + /** Absolute URL of the page as Markdown, advertised as . */ + markdown?: string; } /** @@ -67,6 +69,7 @@ export function pageMetadata({ image, type = 'website', modifiedTime, + markdown, }: PageMetadataInput): Metadata { const url = absoluteUrl(path); // Social cards show the site name separately, so they get the plain title. @@ -76,7 +79,7 @@ export function pageMetadata({ return { title: absoluteTitle ? { absolute: absoluteTitle } : title, description, - alternates: { canonical: url }, + alternates: { canonical: url, ...(markdown ? { types: { 'text/markdown': markdown } } : {}) }, openGraph: { type, siteName: SITE_NAME, @@ -170,7 +173,10 @@ export function techArticleJsonLd(page: { image: string; section?: string; lastModified?: Date; + published?: Date; }) { + // The Organization node the Hub's home page defines (same @id), named so it also stands alone. + const pelican = { '@type': 'Organization', '@id': ORG_ID, name: SITE_NAME, url: `${SITE_URL}/` }; return { '@type': 'TechArticle', headline: page.title, @@ -180,9 +186,11 @@ export function techArticleJsonLd(page: { image: new URL(page.image, SITE_URL).toString(), inLanguage: 'en', ...(page.section ? { articleSection: page.section } : {}), + ...(page.published ? { datePublished: page.published.toISOString() } : {}), ...(page.lastModified ? { dateModified: page.lastModified.toISOString() } : {}), isPartOf: { '@type': 'WebSite', name: SITE_NAME, url: `${SITE_URL}/` }, - publisher: { '@type': 'Organization', name: SITE_NAME, url: `${SITE_URL}/`, logo: `${SITE_URL}/docs/img/logo.png` }, + author: pelican, + publisher: { ...pelican, logo: `${SITE_URL}/docs/img/logo.png` }, }; } From b2f1a0c84f6d5e4bc8e4038bd15531fb8677d2d5 Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:41:39 +0200 Subject: [PATCH 6/9] fix(redirects): 301 old docs URLs that 404 today, and check every redirect target exists /docs/panel/config, /docs/eggs/creating-a-custom-docker-image, /docs/panel/updating-panel, /docs/wings/installing-wings, /docs/wings/updating-wings, /docs/team and /updatePanel.sh. check-links now also fails when a /docs redirect points at a page that isn't built. --- netlify.toml | 45 ++++++++++++++++++++++++++++++++++++ scripts/check-links.mjs | 21 +++++++++++++---- scripts/check-links.test.mjs | 14 ++++++++++- 3 files changed, 74 insertions(+), 6 deletions(-) diff --git a/netlify.toml b/netlify.toml index d91f0771..a9f9fa0d 100644 --- a/netlify.toml +++ b/netlify.toml @@ -192,6 +192,51 @@ status = 301 force = true +# Older names still linked from other sites (they 404 on pelican.dev today). The Hub serves +# the same redirects (its own list); keep both in step. +[[redirects]] + from = "/docs/panel/config" + to = "/docs/panel/standalone/optional-config/" + status = 301 + force = true + +[[redirects]] + from = "/docs/eggs/creating-a-custom-docker-image" + to = "/docs/eggs/creating-a-custom-yolk/" + status = 301 + force = true + +[[redirects]] + from = "/docs/panel/updating-panel" + to = "/docs/panel/update/" + status = 301 + force = true + +[[redirects]] + from = "/docs/wings/installing-wings" + to = "/docs/wings/install/" + status = 301 + force = true + +[[redirects]] + from = "/docs/wings/updating-wings" + to = "/docs/wings/update/" + status = 301 + force = true + +[[redirects]] + from = "/docs/team" + to = "/docs/contributors/" + status = 301 + force = true + +# The update script's old name (outside /docs, so the Hub has it in its own list). +[[redirects]] + from = "/updatePanel.sh" + to = "/update-panel.sh" + status = 301 + force = true + # ---- Markdown for AI tools (lib/llms.ts) --------------------------------- # /docs/panel/update.md is built to out/docs/md/panel/update.md (app/docs/md; # the docs page route owns the other paths under /docs). Not forced, so it only diff --git a/scripts/check-links.mjs b/scripts/check-links.mjs index 839bdc26..49e69f03 100644 --- a/scripts/check-links.mjs +++ b/scripts/check-links.mjs @@ -10,7 +10,8 @@ * browser does (against the page's own URL, which ends in "/" because of trailingSlash), and * fails when a link to this build's paths (router/paths.mjs: /docs/* and the root files): * - goes to a page or file that isn't in out/ and isn't an old path netlify.toml redirects; - * - has an #anchor that the target page has no id for (same-page "#x" links included). + * - has an #anchor that the target page has no id for (same-page "#x" links included); + * and when a /docs redirect in netlify.toml points at a docs page that isn't in the build. * Links to the Hub's pages (/plugins, /eggs, …) and to other sites aren't checked. */ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'; @@ -105,6 +106,17 @@ function walk(dir) { }); } +/** + * netlify.toml's /docs redirects whose target is a docs page that isn't in the build + * (`redirects` as from pack-docs' docsRedirects: `{ from, to }`). Same `{ page, href, reason }`s. + */ +export function brokenRedirects(redirects, pages) { + return redirects + .filter(({ to }) => to.startsWith('/docs')) + .filter(({ to }) => !pages.has(new URL(to, ORIGIN).pathname)) + .map(({ from, to }) => ({ page: `netlify.toml ${from}`, href: to, reason: 'redirects to no page' })); +} + /** Runs the check on a built `outDir`: how many docs pages it read, and the broken links. */ export function checkLinks(outDir, toml = 'netlify.toml') { const files = walk(outDir).map((file) => relative(outDir, file).split(sep).join('/')); @@ -112,10 +124,9 @@ export function checkLinks(outDir, toml = 'netlify.toml') { for (const file of files.filter((f) => f.startsWith('docs/') && f.endsWith('.html'))) { pages.set(pagePathOf(file), readFileSync(join(outDir, file), 'utf8')); } - const redirects = new Set( - existsSync(toml) ? docsRedirects(readFileSync(toml, 'utf8')).map(({ from }) => from.replace(/\/$/, '')) : [], - ); - return { pages: pages.size, broken: brokenLinks(pages, files, redirects) }; + const redirects = existsSync(toml) ? docsRedirects(readFileSync(toml, 'utf8')) : []; + const from = new Set(redirects.map(({ from }) => from.replace(/\/$/, ''))); + return { pages: pages.size, broken: [...brokenLinks(pages, files, from), ...brokenRedirects(redirects, pages)] }; } function main(outDir) { diff --git a/scripts/check-links.test.mjs b/scripts/check-links.test.mjs index ee0901e4..a1d6a477 100644 --- a/scripts/check-links.test.mjs +++ b/scripts/check-links.test.mjs @@ -4,7 +4,7 @@ import { describe, expect, test } from 'bun:test'; import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { dirname, join } from 'node:path'; -import { brokenLinks, idsIn, linksIn, pagePathOf } from './check-links.mjs'; +import { brokenLinks, brokenRedirects, idsIn, linksIn, pagePathOf } from './check-links.mjs'; const page = (body) => `

x

${body}`; @@ -59,6 +59,18 @@ describe('brokenLinks', () => { }); }); +test('a redirect to a docs page that isn\'t built is broken', () => { + const pages = new Map([['/docs/wings/install/', page('')]]); + const redirects = [ + { from: '/docs/wings/installing-wings', to: '/docs/wings/install/' }, + { from: '/docs/glossary', to: '/docs/wings/install/#top' }, + { from: '/docs/team', to: '/docs/team-page/' }, + ]; + expect(brokenRedirects(redirects, pages)).toEqual([ + { page: 'netlify.toml /docs/team', href: '/docs/team-page/', reason: 'redirects to no page' }, + ]); +}); + describe('the script', () => { function build(pagesByFile) { const dir = mkdtempSync(join(tmpdir(), 'check-links-')); From fbd132fcca331d0e4ddda0728476e7f008ba20ab Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:47:59 +0200 Subject: [PATCH 7/9] fix(a11y): the phone sidebar and the search dialog work as dialogs from the keyboard Phone sidebar: Escape closes it, the page behind it is inert, focus moves in when it opens and back to the menu button when it closes. Search: focus returns to the button that opened it, and a live region says how many results there are. --- app/docs/layout.tsx | 2 + app/layout.tsx | 7 +-- components/docs/search-dialog.tsx | 68 +++++++++++++++++++++++++ components/docs/sidebar-modal.tsx | 82 +++++++++++++++++++++++++++++++ 4 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 components/docs/search-dialog.tsx create mode 100644 components/docs/sidebar-modal.tsx diff --git a/app/docs/layout.tsx b/app/docs/layout.tsx index df141d4d..2619b903 100644 --- a/app/docs/layout.tsx +++ b/app/docs/layout.tsx @@ -2,12 +2,14 @@ import { DocsLayout } from 'fumadocs-ui/layouts/docs'; import { docsOptions } from '@/lib/layout.shared'; import { source } from '@/lib/source'; import { DocsTopBar } from '@/components/docs/docs-top-bar'; +import { SidebarModal } from '@/components/docs/sidebar-modal'; export default function Layout({ children }: LayoutProps<'/docs'>) { return (
+ {children}
diff --git a/app/layout.tsx b/app/layout.tsx index 7fc358e0..20a3cfbe 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,6 +2,7 @@ import './global.css'; import { RootProvider } from 'fumadocs-ui/provider/next'; import type { Metadata } from 'next'; import { Bricolage_Grotesque, Instrument_Sans, JetBrains_Mono } from 'next/font/google'; +import { DocsSearchDialog } from '@/components/docs/search-dialog'; import { ExternalLinkGuard } from '@/components/external-link-guard'; import { ASSET_URL, IS_PRODUCTION, OG_SIZE, SITE_NAME, ogImage } from '@/lib/og'; @@ -43,9 +44,9 @@ export default function RootLayout({ children }: LayoutProps<'/'>) { {children} diff --git a/components/docs/search-dialog.tsx b/components/docs/search-dialog.tsx new file mode 100644 index 00000000..494c43b7 --- /dev/null +++ b/components/docs/search-dialog.tsx @@ -0,0 +1,68 @@ +'use client'; + +import { useRef } from 'react'; +import type { SharedProps } from 'fumadocs-ui/contexts/search'; +import { + SearchDialog, + SearchDialogClose, + SearchDialogContent, + SearchDialogHeader, + SearchDialogIcon, + SearchDialogInput, + SearchDialogList, + SearchDialogOverlay, +} from 'fumadocs-ui/components/dialog/search'; +import { useStaticSearch } from 'fumadocs-core/search/client/orama-static'; + +/** + * Fumadocs' default search dialog (components/dialog/search-default), with three fixes for + * keyboard and screen reader users: + * - on close, focus goes back to what opened it (a search button), not to ; + * - "N results" is announced in a live region while results show; + * - the input has a visible focus ring (app/global.css). + * The index is the static file built with the site (app/docs/search.json). + */ +export function DocsSearchDialog({ open, onOpenChange }: SharedProps) { + const search = useStaticSearch({ from: '/docs/search.json' }); + const opener = useRef(null); + + return ( + + + { + const focused = document.activeElement; + // Opened with ⌘K/Ctrl K, or a click that didn't focus the button (Safari): use a visible search button. + opener.current = + focused instanceof HTMLElement && focused !== document.body + ? focused + : (Array.from(document.querySelectorAll('[data-search-full], [data-search]')).find( + (button) => button.offsetParent !== null, + ) ?? null); + }} + onCloseAutoFocus={(event) => { + if (!opener.current?.isConnected) return; + event.preventDefault(); + opener.current.focus(); + }} + > + + + + + + +

+ {resultsMessage(search.search, search.isLoading, search.data?.items)} +

+
+
+ ); +} + +function resultsMessage(query: string, isLoading: boolean, items: { type: string; rows?: unknown[] }[] | undefined) { + if (!query.trim() || isLoading || !items) return ''; + const count = items.reduce((n, item) => n + (item.type === 'table' ? (item.rows?.length ?? 0) : 1), 0); + return count === 0 ? 'No results' : `${count} result${count === 1 ? '' : 's'}`; +} diff --git a/components/docs/sidebar-modal.tsx b/components/docs/sidebar-modal.tsx new file mode 100644 index 00000000..f2d6d272 --- /dev/null +++ b/components/docs/sidebar-modal.tsx @@ -0,0 +1,82 @@ +'use client'; + +import { useEffect, useRef } from 'react'; +import { useSidebar } from 'fumadocs-ui/layouts/docs/slots/sidebar'; + +const DRAWER = 'nd-sidebar-mobile'; + +/** + * Makes Fumadocs' phone sidebar (#nd-sidebar-mobile) behave as the modal dialog it looks + * like: Escape closes it, everything behind it is `inert` (Tab can't reach the hidden page, + * screen readers don't read it), focus moves into it when it opens and back to the + * "Open Sidebar" button when it closes. Renders nothing; it only follows the sidebar's state. + */ +export function SidebarModal() { + const { open, setOpen, mode } = useSidebar(); + const active = open && mode === 'drawer'; + const wasActive = useRef(false); + + useEffect(() => { + if (!active) { + if (wasActive.current) { + wasActive.current = false; + // Back to the button that opened it, unless focus already went somewhere on purpose. + const focused = document.activeElement; + if (!focused || focused === document.body || focused.closest(`#${DRAWER}`)) { + document.querySelector(`[aria-controls="${DRAWER}"]:not(#${DRAWER} *)`)?.focus(); + } + } + return; + } + wasActive.current = true; + + let undo: (() => void) | undefined; + // The drawer mounts with this render; wait a frame for it. + const frame = requestAnimationFrame(() => { + const drawer = document.getElementById(DRAWER); + if (!drawer) return; + undo = makeModal(drawer); + drawer.querySelector('a[href], button:not([disabled]), input, [tabindex]:not([tabindex="-1"])')?.focus(); + }); + + const onKeyDown = (event: KeyboardEvent) => { + if (event.key === 'Escape' && !event.defaultPrevented) { + event.preventDefault(); + setOpen(false); + } + }; + document.addEventListener('keydown', onKeyDown); + + return () => { + cancelAnimationFrame(frame); + document.removeEventListener('keydown', onKeyDown); + undo?.(); + }; + }, [active, setOpen]); + + return null; +} + +/** + * Marks the drawer as a modal dialog and makes everything else on the page inert: each + * sibling of the drawer and of its ancestors, except the backdrop (a click on it closes the + * drawer). Returns a function that undoes it. + */ +function makeModal(drawer: HTMLElement): () => void { + const backdrop = drawer.previousElementSibling?.hasAttribute('data-state') ? drawer.previousElementSibling : null; + const made: Element[] = []; + for (let node: HTMLElement | null = drawer; node && node !== document.body; node = node.parentElement) { + for (const sibling of Array.from(node.parentElement?.children ?? [])) { + if (sibling === node || sibling === backdrop || sibling.hasAttribute('inert')) continue; + sibling.setAttribute('inert', ''); + made.push(sibling); + } + } + drawer.setAttribute('role', 'dialog'); + drawer.setAttribute('aria-modal', 'true'); + drawer.setAttribute('aria-label', 'Docs navigation'); + return () => { + for (const element of made) element.removeAttribute('inert'); + drawer.removeAttribute('aria-modal'); + }; +} From 1661f2bdd05f0682e8465576c8d3f842d8d01f98 Mon Sep 17 00:00:00 2001 From: "Alexandru Vlad (Scai)" <59282365+alexevladgabriel@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:47:59 +0200 Subject: [PATCH 8/9] fix(a11y): skip link, clearer names, readable code comments, visible edges and focus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - "Skip to content" is the first thing Tab reaches. - The brand link's name includes its visible text; code scroll areas are named; "Open" reads "Open in…". - Code comments use #8b949e (4.6:1 or more, also on highlighted lines). - Dark-theme control edges are 3:1 or more; the search input shows a focus ring. - The logo icon is a 5 KB WebP instead of the 36 KB PNG. --- app/global.css | 46 ++++++++++++++++++++++--- components/docs/docs-top-bar.tsx | 54 +++++++++++++++++------------- components/docs/page-actions.tsx | 4 ++- components/home/feature-panel.tsx | 2 +- components/home/sections.tsx | 4 +-- components/home/site-header.tsx | 2 +- lib/layout.shared.tsx | 2 +- mdx-components.tsx | 7 ++++ public/docs/img/logo-96.webp | Bin 0 -> 5372 bytes source.config.ts | 4 +++ 10 files changed, 90 insertions(+), 35 deletions(-) create mode 100644 public/docs/img/logo-96.webp diff --git a/app/global.css b/app/global.css index 80ceb1bd..f486d208 100644 --- a/app/global.css +++ b/app/global.css @@ -75,6 +75,12 @@ } } +/* The search dialog's input: Fumadocs turns its outline off; give it one back. */ +input[aria-controls='fd-search-list']:focus-visible { + outline: 2px solid var(--color-fd-ring); + outline-offset: 2px; +} + /* Values filled in from the reader's are underlined, so it is clear which parts of a config file came from them. */ [data-setup][data-filled] { @@ -182,9 +188,35 @@ figure.shiki { outline-offset: 2px; } -/* The search box shows focus with its caret; the dialog's edge already frames it. */ +/* The search box gets the same ring (Fumadocs turns its outline off). */ :root:has(.dt-root) [role='dialog'] input:focus-visible { - outline: none; + outline: 3px solid var(--pl-fg); + outline-offset: 2px; +} + +/* Dark theme: edges of controls (search box, buttons, theme switch) at 3:1 or more against + the bar and the cards, so they can be told apart (WCAG 1.4.11). --pl-edge is 1.9:1 there. */ +:root.dark:has(.dt-root) { + --dt-control-edge: #5b7a8c; +} + +/* "Skip to content" (components/docs/docs-top-bar.tsx): off screen until focused. */ +.dt-skip { + position: fixed; + top: 12px; + left: 12px; + z-index: 100; + padding: 12px 16px; + border: 3px solid var(--pl-ink); + background: var(--pl-sky); + color: var(--pl-ink); + font: 700 15px/1 var(--font-sans); + text-decoration: none; + transform: translateY(-200%); +} + +.dt-skip:focus { + transform: none; } .dt-root ::selection { @@ -265,7 +297,7 @@ figure.shiki { } .dark .dt-bar__search { - border-color: var(--pl-edge) !important; + border-color: var(--dt-control-edge) !important; background: var(--pl-card) !important; } @@ -338,7 +370,7 @@ figure.shiki { } .dark .dt-root [data-theme-toggle] { - border-color: var(--pl-edge); + border-color: var(--dt-control-edge); background: var(--pl-card); } @@ -373,7 +405,7 @@ figure.shiki { } .dark .dt-btn { - border-color: var(--pl-edge); + border-color: var(--dt-control-edge); background: var(--pl-card); color: var(--pl-fg); } @@ -942,6 +974,10 @@ figure.shiki { color: var(--pl-kicker); } +.dark .dt-root .dt-action { + border-color: var(--dt-control-edge); +} + .dt-root .dt-action:hover { background: var(--pl-hover); } diff --git a/components/docs/docs-top-bar.tsx b/components/docs/docs-top-bar.tsx index 79c16064..42adafc1 100644 --- a/components/docs/docs-top-bar.tsx +++ b/components/docs/docs-top-bar.tsx @@ -12,31 +12,37 @@ import { navOutsideDocs, siteNav } from '@/lib/nav'; */ export function DocsTopBar() { return ( -
- {/* Plain links: / and the paths in the site nav are the Hub's pages, not this app's. */} - - {/* eslint-disable-next-line @next/next/no-img-element */} - - Pelican - Docs + <> + {/* First on the page for keyboard users; shown when focused. #nd-page is Fumadocs' article. */} + + Skip to content - - - -
+ + +
+ + + {(project.stars / 1000).toFixed(1)}k + + + {siteNav.cta.label} + +
+ + ); } diff --git a/components/docs/page-actions.tsx b/components/docs/page-actions.tsx index de676768..e0ff5074 100644 --- a/components/docs/page-actions.tsx +++ b/components/docs/page-actions.tsx @@ -21,7 +21,9 @@ export function PageActions({ markdownUrl, githubUrl }: { markdownUrl: string; g } title="Copy every docs page as one Markdown file (about 60,000 tokens)"> Copy all docs - + + Open in… + ); } diff --git a/components/home/feature-panel.tsx b/components/home/feature-panel.tsx index 6d20e1d9..882edec4 100644 --- a/components/home/feature-panel.tsx +++ b/components/home/feature-panel.tsx @@ -63,7 +63,7 @@ export function FeaturePanel() {
{/* eslint-disable-next-line @next/next/no-img-element */} - + Pelican / Servers / Minecraft SMP diff --git a/components/home/sections.tsx b/components/home/sections.tsx index 922b8bcc..25c51c03 100644 --- a/components/home/sections.tsx +++ b/components/home/sections.tsx @@ -195,7 +195,7 @@ export function FeaturesSection() {
{/* eslint-disable-next-line @next/next/no-img-element */} - + Panel Web UI + API @@ -480,7 +480,7 @@ export function SiteFooterNav() {
{/* eslint-disable-next-line @next/next/no-img-element */} - + Pelican

A free, open-source game server panel, built by its community.

diff --git a/components/home/site-header.tsx b/components/home/site-header.tsx index 99516c0c..d47412df 100644 --- a/components/home/site-header.tsx +++ b/components/home/site-header.tsx @@ -22,7 +22,7 @@ export function SiteHeader() {
{/* eslint-disable-next-line @next/next/no-img-element */} - + Pelican