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

ENH: Add logo_link theme option #246

Merged
merged 10 commits into from
Dec 28, 2020
10 changes: 10 additions & 0 deletions docs/user_guide/configuring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ doc path's _static folder, and use the following configuration:

html_logo = "_static/logo.png"

The logo links to ``master_doc`` (usually the first page of your documentation) by default.
If you'd like it to link to another page or use an external link instead, use the following configuration:

.. code:: python

html_theme_options = {
"logo_link": "<other page or external link>"
}


Configure social media buttons
==============================

Expand Down
20 changes: 17 additions & 3 deletions pydata_sphinx_theme/docs-navbar.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@

<div class="container-xl">

<a class="navbar-brand" href="{{ pathto(master_doc) }}">

{% if logo %}
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo" />
{% if not theme_logo_link %}
<a class="navbar-brand" href="{{ pathto(master_doc) }}">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
</a>
{% elif theme_logo_link[:4] == 'http' %}
<a class="navbar-brand" href="{{ theme_logo_link }}">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
</a>
{% else %}
<a class="navbar-brand" href="{{ pathto(theme_logo_link) }}">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
</a>
{% endif %}
leonarduschen marked this conversation as resolved.
Show resolved Hide resolved
{% else %}
<a class="navbar-brand" href="{{ pathto(master_doc) }}">
<p class="title">{{ project }}</p>
{% endif %}
</a>
{% endif %}

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Expand Down
1 change: 1 addition & 0 deletions pydata_sphinx_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sidebarwidth = 270
sidebar_includehidden = True
use_edit_page_button = False
external_links =
logo_link =
github_url =
twitter_url =
google_analytics_id =
Expand Down