Skip to content

Restore print/PDF output with multi-language support #19

Description

@helmihyo

Context

mkdocs-print-site-plugin was removed in #18 (Finnish translation). It has no i18n support: it builds a single print page for the default language only, so every Finnish page would have linked to an English print page under an English tooltip. Removing it was the right call for that PR — the print button would have lied on Finnish pages.

The removal took a working English feature with it. The site previously published /print_page/ and showed a printer button on every page (docs/overrides/main.html lines 13–15, guarded by page.url_to_print_page). That guard is now always false, so the button disappears everywhere and the URL 404s.

The template override is left in place untouched, so restoring the plugin restores the button with no template work.

What to figure out

Printing should come back, but only with something that produces a per-language print page. Worth evaluating:

  • Whether mkdocs-print-site-plugin has gained i18n support, or whether mkdocs-static-i18n's multi-build model can drive it once per language.
  • Gating the button by locale as an interim measure — mkdocs-static-i18n injects i18n_page_locale into the template context, so the existing guard in main.html can be narrowed to English. That restores /print_page/ and the English button without lying to Finnish readers.
  • A different approach entirely, such as per-language PDF export in CI.

Decide

Whether /print_page/ returning 404 in the meantime is acceptable, or whether it warrants a redirect until printing returns.

See also

hatlabs/halpi2#27 — the same problem, same cause, still open. Whatever solves one should solve both, and the two repositories now share the translation machinery, so a fix is worth writing once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions