Skip to content

Commit

Permalink
Expose logo_link in theme.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
MridulS committed Jun 3, 2024
1 parent b45af6c commit e10f6a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
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

0 comments on commit e10f6a5

Please sign in to comment.