Documenter.jl icon indicating copy to clipboard operation
Documenter.jl copied to clipboard

Use the `h1`-based long title for page titles

Open mortenpi opened this issue 2 years ago • 2 comments

What goes into <title> tags and such is the same as what we show in the navigation (i.e. if a pages override is present, that gets used). Instead, maybe we should use the h1 heading for that metadata, because it is useful if that would contain a bit more information (the version in pages is usually the short version of the title).

We could formalize this by saying that each page has two titles:

  1. Long title. Determined from h1 (we could possibly add an at-meta override too), used for <title> and <meta> tags. If h1 is missing, the short title is used to populate this. We could also provide an at-meta override for this.
  2. Short title. Determined from pages, or set to long title if not present in pages. Used in the left-side navbar, breadcrumb.

In the PDF/LaTeX output.. I am not sure what we actually use, but since we can't really control the ToC explicitly, I presume we are effectively always using the "long title".

Slightly related to #2154 -- it can solve that issue in cases where the <title> tags repeat because of the "short" titles in pages.

mortenpi avatar Jun 26 '23 01:06 mortenpi

Related: #1371.

mortenpi avatar Jul 12 '23 03:07 mortenpi

Specifically any change here would have to touch https://github.com/JuliaDocs/Documenter.jl/blob/2e6d9dabe32d72da03a9fc0cd184817a955e04c1/src/html/HTMLWriter.jl#L957-L965

asinghvi17 avatar Feb 13 '25 18:02 asinghvi17