From e7620dd9e75a1500c499659679280c1178b701de Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Sat, 25 Feb 2023 17:06:35 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=9A=20Fix=20landing=20page=20title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/conf.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index fe7c8708..54284da6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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_landing_page_title) def add_version_to_css(app, pagename, templatename, context, doctree): @@ -233,3 +234,13 @@ 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_landing_page_title(app, pagename, templatename, context, doctree): + """Fix the title of the landing page, + since we want the heading to be different to the title. + """ + if app.builder.name != "html": + return + if pagename == "index": + context["title"] = "MyST-Parser Documentation" From 20cebe0e1333e41269aad05dfea76eeebc59ef9c Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Sat, 25 Feb 2023 17:12:24 +0100 Subject: [PATCH 2/3] Update conf.py --- docs/conf.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 54284da6..cc40b860 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -224,7 +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_landing_page_title) + app.connect("html-page-context", fix_page_titles) def add_version_to_css(app, pagename, templatename, context, doctree): @@ -236,11 +236,9 @@ def add_version_to_css(app, pagename, templatename, context, doctree): context["css_files"][index] = f"_static/local.css?v={__version__}" -def fix_landing_page_title(app, pagename, templatename, context, doctree): - """Fix the title of the landing page, - since we want the heading to be different to the title. - """ +def fix_page_titles(app, pagename, templatename, context, doctree): + """Prepend tags with "MyST-Parser: " so they are more searchable.""" if app.builder.name != "html": return if pagename == "index": - context["title"] = "MyST-Parser Documentation" + context["title"] = "MyST-Parser: " + context.get("title", "") From e9a96f4b95599ae6b1e82088b6f7efb5280d8b22 Mon Sep 17 00:00:00 2001 From: Chris Sewell <chrisj_sewell@hotmail.com> Date: Sat, 25 Feb 2023 17:14:25 +0100 Subject: [PATCH 3/3] Update conf.py --- docs/conf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index cc40b860..121cd43c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -240,5 +240,4 @@ 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 - if pagename == "index": - context["title"] = "MyST-Parser: " + context.get("title", "") + context["title"] = "MyST-Parser: " + context.get("title", "")