Docs Site
The documentation site is a Vite, React, and MDX static app in packages/docs. It is published at docs.photo.jackyw.cn and documents this customized Jacky's Photography repository, not upstream Afilmory in general. Keep examples aligned with the current workspace, deployment workflow, private photo checkout, and builder.config.ts.
Public URLs
- Documentation site: docs.photo.jackyw.cn
- Photography gallery: photo.jackyw.cn
- Jacky's homepage: jackyw.cn
Content Structure
Documentation pages live in packages/docs/contents/:
index.mdxis the task-oriented entry point for readers.architecture/index.mdxis the authority for workspace ownership, package boundaries, and generated data flow.accessibility/index.mdxdocuments keyboard navigation, dialog focus, sharing fallbacks, and manifest-visibility boundaries.photo-metadata/index.mdxdocuments manual descriptions, tag curation, manifest merge behavior, and photo SEO output.storage/index.mdxdocuments supported builder storage providers and the current local/R2 setup.performance/index.mdxrecords image loading, manifest, and chunk-splitting decisions.deployment/*.mdxcontains platform-specific deployment notes.docs-site.mdxexplains how to maintain this documentation site.
Route generation follows the file system:
contents/index.mdxbecomes/.contents/storage/index.mdxbecomes/storage.contents/accessibility/index.mdxbecomes/accessibility.contents/photo-metadata/index.mdxbecomes/photo-metadata.contents/deployment/github-pages.mdxbecomes/deployment/github-pages.
The route generator writes src/routes.ts and src/routes.json; treat both as generated files.
Route keys omit trailing slashes internally. Public links, canonical URLs, social metadata and sitemap entries use directory URLs such as /architecture/, matching the generated architecture/index.html file. Reuse the path helpers in src/site.ts when adding navigation.
Sidebar and content navigation use real links. Ordinary same-origin document clicks update the content and history without reloading; Back and Forward restore the corresponding route and metadata. Modified clicks and external links retain browser behavior. src/page-meta.ts supplies the metadata for both static output and client navigation.
Commands
From the repository root:
pnpm docs:dev
pnpm docs:build
pnpm docs:preview
pnpm create:doc
From packages/docs/ directly:
pnpm dev
pnpm build
pnpm preview
pnpm create:doc
pnpm docs:build runs TypeScript and Vite client builds, regenerates routes and table-of-contents data, renders the static pages, and finalizes output through packages/docs/scripts/build.ts.
Writing Pages
Every page must include frontmatter:
---
title: Page Title
description: Short page description.
createdAt: 2026-08-30T13:22:42+08:00
lastModified: 2026-08-30T13:22:42+08:00
---
Update lastModified whenever a content page changes. The repository hook runs pnpm update:lastmodified for staged Markdown and MDX files, and you can also run it manually with file paths when needed.
Use pnpm create:doc for new pages when you want scaffolded frontmatter and route placement prompts.
Style Notes
- Keep docs operational and specific to this repository.
- Use Node.js 24, pnpm 10.19.0, React 19, Vite, and the current workspace package names in examples.
- Describe the current manifest relationship accurately: builder writes
apps/web/src/data/photos-manifest.json;packages/data/src/photos-manifest.jsonis a symlink to it. - Document
apps/web/dist/as the web build output andJackyhq/Photography-Webas the mirrored deployment repository. - Keep photo metadata docs aligned with
content/photo-descriptions.json,scripts/sync-photo-descriptions.ts, andplugins/builder/photo-descriptions.ts. - Do not describe
photos/as sample media. It is a private checkout containing copyrighted personal photos. - Avoid committing local generated output,
.DS_Store, or tool conversation history. - When changing
packages/docs/contents/deployment/*, verify the commands against.github/workflows/deploy.ymland rootpackage.json.
Verification
Before publishing documentation changes, run:
pnpm docs:build
For content-only edits, this catches route generation, MDX syntax, table-of-contents extraction, and static rendering issues.
For routing, metadata or generation changes, also run:
pnpm exec vitest run packages/docs
Then check a direct nested URL, sidebar navigation followed by Back and Forward, the address bar and canonical URL, opening a link in another tab, and an unknown route. Documentation builds and tests do not need the private photo checkout.
Hosting and HTTP Status
Publish the complete packages/docs/dist/ output at the documentation domain. The build creates every document's directory index.html, a top-level 404.html, robots.txt, and sitemap.xml. Only published document routes appear in the sitemap. The 404 page contains the actual not-found content, uses noindex, follow, and has no canonical or structured data pointing to the homepage.
The source repository's deployment workflow validates the docs build but mirrors only the gallery's apps/web/dist/ to Jackyhq/Photography-Web. Configure the documentation host separately to run pnpm docs:build from the repository root and publish packages/docs/dist/. Repository output changes do not themselves update that external project's settings.
The host must serve generated files before applying fallbacks, redirect directory URLs consistently to their trailing-slash form, and return the contents of 404.html with HTTP status 404 for unknown paths. Do not rewrite every missing URL to the homepage with status 200. A client-rendered 404 cannot change an HTTP status already sent by the host.
On Cloudflare Pages, a top-level 404.html disables the default SPA fallback, and directory index pages use trailing-slash URLs. See Serving Pages for those host defaults. Existing Workers, Functions, custom rewrites or redirects may override static serving and must be checked on the deployment itself.
After deployment, verify that /architecture/, /sitemap.xml, and /robots.txt return their respective files with status 200, /architecture redirects consistently to /architecture/, and an arbitrary missing path returns the generated 404 content with status 404. This final check validates the external hosting configuration; it cannot be inferred from a local build.
| Created At | |
| Last Modified |