Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摎 Prefix HTML page titles #722

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/conf.py
Expand Up @@ -224,6 +224,7 @@ def setup(app: Sphinx):
app.add_directive("myst-example", MystExampleDirective)
app.add_post_transform(StripUnsupportedLatex)
app.connect("html-page-context", add_version_to_css)
app.connect("html-page-context", fix_page_titles)


def add_version_to_css(app, pagename, templatename, context, doctree):
Expand All @@ -233,3 +234,10 @@ def add_version_to_css(app, pagename, templatename, context, doctree):
if "_static/local.css" in context.get("css_files", {}):
index = context["css_files"].index("_static/local.css")
context["css_files"][index] = f"_static/local.css?v={__version__}"


def fix_page_titles(app, pagename, templatename, context, doctree):
"""Prepend <title> tags with "MyST-Parser: " so they are more searchable."""
if app.builder.name != "html":
return
context["title"] = "MyST-Parser: " + context.get("title", "")