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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose logo_link in theme.conf #1850

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/pydata_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def update_config(app):
theme_logo = {}
if not isinstance(theme_logo, dict):
raise ValueError(f"Incorrect logo config type: {type(theme_logo)}")
theme_logo_link = theme_options.get("theme_logo_link")
if theme_logo_link:
theme_logo["link"] = theme_logo_link
theme_options["logo"] = theme_logo


Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{# Displays the logo of your documentation site, in the header navbar. #}
{# Logo link generation -#}
{% if not theme_logo.get("link") %}
{% set href = pathto(root_doc) %}
{% elif hasdoc(theme_logo.get("link")) %}
{% set href = pathto(theme_logo.get("link")) %} {# internal page #}
{% if theme_logo_link %}
{% set href = theme_logo_link %}
{% else %}
{% set href = theme_logo.get("link") %} {# external url #}
{% if not theme_logo.get("link") %}
{% set href = pathto(root_doc) %}
{% elif hasdoc(theme_logo.get("link")) %}
{% set href = pathto(theme_logo.get("link")) %} {# internal page #}
{% else %}
{% set href = theme_logo.get("link") %} {# external url #}
{% endif %}
{% endif %}

{#- Logo HTML and image #}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ check_switcher = True
pygments_light_style = a11y-high-contrast-light
pygments_dark_style = a11y-high-contrast-dark
logo =
logo_link =
surface_warnings = True
back_to_top_button = True

Expand Down
Loading