Skip to content

Base href in doc generator's 404 error page #16101

@straight-shoota

Description

@straight-shoota

The 404 error page renders when a path doesn't exist. This path may consist of several nested components (e.g. foo/bar/baz) which puts the 404 page in a different location than the 404.html file itself. It's rendered location is flexible. We must consider this for links to other pages. Relative reference don't work out of the box because the location of the 404 page itself is a moving target.

A fixed base path could help. But here is the complication that it needs to be an absolute path, i.e. we need to now under which path the docs are mounted at the time of building the documentation (e.g. /api/1.17.1).
Currently, we just have a bunch of HTML files and they work anywhere.

A potential solution is presented in #16091: A CLI flag to define the base href.

There's also some overlap with #15605 (comment).

A working alternative is to inject <base> tags into the rendered HTML files outside of the doc generator.
That's what we're currently doing for the 404 page of https://crystal-lang.org/api/

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions