feat(pdf): whole-product PDF export with download button on OPCP landing page#329
Draft
Y0Coss wants to merge 5 commits into
Draft
feat(pdf): whole-product PDF export with download button on OPCP landing page#329Y0Coss wants to merge 5 commits into
Y0Coss wants to merge 5 commits into
Conversation
…ing page Bundle a product's landing page + all descendant guides into one PDF with a nested outline, clickable TOC, running header/footer and OVHcloud cover branding. - scripts/pdf/: engine-agnostic core (sidebar resolver, MDX sanitizer, digest) plus a local Chromium generator (pdf:local) and a pandoc/weasyprint Dockerfile for CI. - PdfDownloadButton: frontmatter opt-in (pdf: <ref>), mounted in LandingLayout since the Ask-AI cluster is absent there; opens the PDF inline in a new tab. - i18n: relabel to 'Download full documentation (PDF)' across all 7 locales. - Staging: commit a pre-generated OPCP PDF under static-pdfs/ and copy it into dist/pdfs/ at build time (build:static-pdfs) so CDS needs no pandoc/Chromium.
Section titles in the outline/TOC came from index.md (EN-only); now resolved via the sidebar.gen.* i18n keys so non-EN PDFs get translated dividers (Premiers pas, Sécurité…), matching the live sidebar. Adds the FR OPCP PDF alongside EN under static-pdfs/.
…resh command - Serve PDFs from docs/public/pdfs/ (rspress publicDir) instead of a custom copy step, so they reach /pdfs/ regardless of the CDS build command (fixes the 404). - Tag the FR OPCP landing page with pdf: (it lacked the button); button falls back to the EN PDF on locales without their own (de/es/it/pl/pt), never 404. - Cover shows a localized generation date so a maintainer can compare it against the latest guide changes and know when to regenerate. - pnpm pdf:refresh <ref> [locales] regenerates and drops PDFs straight into docs/public/pdfs/ (replaces the removed build:static-pdfs copy step).
The site is served under per-locale path prefixes (/en/, /fr/…) and docs/public/ is copied into each locale's output, so the PDF lives at /<locale>/pdfs/<pdf-locale>/…, not at the site root. The button linked to /pdfs/… → 404. Prefix the href with the current locale (fixes the staging 404).
rspress copies docs/public/pdfs/ into every dist/<locale>/pdfs/. combine-builds now moves one copy to the shared dist/pdfs/ and drops the per-locale duplicates (same pattern as images), so PDFs are served from the root /pdfs/<locale>/… — a single shared copy instead of one per locale. Reverts the previous per-locale link prefix. Both /pdfs/en/… and /pdfs/fr/… survive; the button picks by page locale.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bundle a product's landing page + all descendant guides into one PDF with a nested outline, clickable TOC, running header/footer and OVHcloud cover branding.