Skip to content

ENH: Add logo_link theme option #246

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

Merged
merged 10 commits into from
Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from 7 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
9 changes: 9 additions & 0 deletions docs/user_guide/configuring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ doc path's _static folder, and use the following configuration:

html_logo = "_static/logo.png"

The logo links to ``master_doc`` by default. If you'd like to link to other page
Copy link
Collaborator

@choldgraf choldgraf Oct 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The logo links to ``master_doc`` by default. If you'd like to link to other page
The logo links to ``master_doc`` (usually the first page of your documentation) by default. If you'd like to link to another page

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on "other page" to "another page" but the logo really links to master_doc by default though and sometimes master_doc is not the landing page (e.g. numpy dev docs).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm - fair enough, what do you think about the new language suggestion? The thing is that most users don't know what master_doc is so I prefer using terminology that the "average" user will likely understand

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another thing we could do instead is include a link to the Sphinx documentation for master_doc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the new language suggestion is pretty informative!

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 %}
{% 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