Sphinx documentation: define but hide heading/title text
Asked Answered
G

1

7

I'm using Sphinx to document a Python package. The top of the title page / splash page holds a graphic with a logo and text for the project. This gives the visual appearance that I want, but because I have defined no top-level heading the page title metadata (which renders in the browser tab) is set to <no title> — my project name.

Is there a way I can do one of the following?

  1. Define a title text but not have it render as a heading on the page?
  2. Set the title page metadata some other way?
Greaser answered 18/7, 2017 at 21:54 Comment(0)
R
5

You can customize the theme, overriding the part that contains the <title> tag. See Templating in the Sphinx documentation for complete information. If you have the "basic" theme, you would need to override line 130 in layout.html

    <title>{{ title|striptags|e }}{{ titlesuffix }}</title>

You can apply control structures in themes using Jinja2 templating language, in case you want to apply this feature for only one page and not others.

Rego answered 19/7, 2017 at 9:15 Comment(1)
This is a good answer but I wonder how to do it ONLY FOR ONE page (e.g. start page).Ive

© 2022 - 2024 — McMap. All rights reserved.