diff --git a/sphinx_immaterial/__init__.py b/sphinx_immaterial/__init__.py index 2c4008558..4a3c7865a 100644 --- a/sphinx_immaterial/__init__.py +++ b/sphinx_immaterial/__init__.py @@ -29,6 +29,7 @@ "search": {}, }, "icon": {}, + "pdf_url": "", "repo_url": "", "edit_uri": "", "globaltoc_collapse": True, @@ -211,6 +212,7 @@ def html_page_context( "theme": theme_options, "site_url": theme_options.get("site_url"), "site_name": context["docstitle"], + "pdf_url": theme_options.get("pdf_url"), "repo_url": theme_options.get("repo_url"), "repo_name": theme_options.get("repo_name", None), "extra": { diff --git a/sphinx_immaterial/theme.conf b/sphinx_immaterial/theme.conf index 262d0baf3..d085df16d 100644 --- a/sphinx_immaterial/theme.conf +++ b/sphinx_immaterial/theme.conf @@ -54,6 +54,9 @@ repo_type = github # source file. This is typically in the form of 'blob//'. edit_uri = +# Relative or absolute location of the PDF +pdf_url = + # Sitemap generation # Specify a base_url used to generate sitemap.xml links. If not specified, then # no sitemap will be built. diff --git a/src/partials/header.html b/src/partials/header.html index 46b69256b..8baebfff0 100644 --- a/src/partials/header.html +++ b/src/partials/header.html @@ -134,6 +134,21 @@ {% endif %} + + {% if config.pdf_url %} + + {% endif %} + {% if "search" in config.plugins %}