Skip to content

Commit 1e85e51

Browse files
committed
ENH: remove the need to specify the icon links
1 parent b10c471 commit 1e85e51

File tree

7 files changed

+57
-56
lines changed

7 files changed

+57
-56
lines changed

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
6-
SPHINXOPTS ?= "-vv"
6+
SPHINXOPTS ?= "-vvv"
77
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = .
99
BUILDDIR = _build

docs/conf.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,12 @@
2828
# -- Options for HTML output -------------------------------------------------
2929

3030
html_theme = "mpl_sphinx_theme"
31-
html_logo = "_static/logo2.svg"
3231
html_favicon = "_static/favicon.ico"
3332
html_theme_options = {
3433
"logo_link": "https://matplotlib.org/stable/",
3534
# collapse_navigation in pydata-sphinx-theme is slow, so skipped for local
3635
# and CI builds https://github.com/pydata/pydata-sphinx-theme/pull/386
3736
"collapse_navigation": not is_release_build,
38-
"icon_links": [
39-
{
40-
"name": "gitter",
41-
"url": "https://gitter.im/matplotlib",
42-
"icon": "fab fa-gitter",
43-
},
44-
{
45-
"name": "discourse",
46-
"url": "https://discourse.matplotlib.org",
47-
"icon": "fab fa-discourse",
48-
},
49-
{
50-
"name": "GitHub",
51-
"url": "https://github.com/matplotlib/matplotlib",
52-
"icon": "fab fa-github-square",
53-
},
54-
{
55-
"name": "twitter",
56-
"url": "https://twitter.com/matplotlib/",
57-
"icon": "fab fa-twitter-square",
58-
},
59-
],
6037
"show_prev_next": False,
6138
"navbar_center": ["mpl_nav_bar.html"],
6239
"native_site": False

docs/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ line in your conf.py file
1919
And by including ``mpl_sphinx_theme`` as a requirement in your documentation
2020
installation.
2121

22-
Note that the theme does not currently install the `logo2.svg` or
23-
the `favicon.ico`. You shoudl copy those from `docs/_static` to
24-
the local project `docs/_static`.
22+
Note that the option ``html_logo`` need not be specified as it is for
23+
``pydata-sphinx-theme``.
24+
25+
To change the top navbar, edit ``mpl_sphinx_theme/mpl_nav_bar.html``
2526

2627
The full ``conf.py`` is
2728

mpl_sphinx_theme/icon-links.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{%- macro icon_link_nav_item(url, icon, name) -%}
2+
{%- if url | length > 2 %}
3+
<li class="nav-item">
4+
<a class="nav-link" href="{{ url }}" rel="noopener" target="_blank" title="{{ _(name) }}">
5+
<span><i class="{{ icon }}"></i></span>
6+
<label class="sr-only">{{ _(name) }}</label>
7+
</a>
8+
</li>
9+
{%- endif -%}
10+
{%- endmacro -%}
11+
{%- if theme_icon_links %}
12+
<ul id="navbar-icon-links" class="navbar-nav" aria-label="{{ _(theme_icon_links_label) }}">
13+
{%- block icon_link_shortcuts -%}
14+
{{ icon_link_nav_item(theme_github_url, "fab fa-github-square", "GitHub") -}}
15+
{{ icon_link_nav_item(theme_gitlab_url, "fab fa-gitlab", "GitLab") -}}
16+
{{ icon_link_nav_item(theme_bitbucket_url, "fab fa-bitbucket", "Bitbucket") -}}
17+
{{ icon_link_nav_item(theme_twitter_url, "fab fa-twitter-square", "Twitter") -}}
18+
{% endblock -%}
19+
{%- for icon_link in theme_icon_links -%}
20+
{{ icon_link_nav_item(icon_link["url"], icon_link["icon"], icon_link["name"]) -}}
21+
{%- endfor %}
22+
</ul>
23+
{%- else %}
24+
<ul id="navbar-icon-links" class="navbar-nav" aria-label="{{ _(theme_icon_links_label) }}">
25+
<li class="nav-item">
26+
<a class="nav-link" href="https://gitter.im/matplotlib" rel="noopener" target="_blank" title="gitter">
27+
<span><i class="fab fa-gitter"></i></span>
28+
<label class="sr-only">gitter</label>
29+
</a>
30+
</li>
31+
<li class="nav-item">
32+
<a class="nav-link" href="https://discourse.matplotlib.org" rel="noopener" target="_blank" title="discourse">
33+
<span><i class="fab fa-discourse"></i></span>
34+
<label class="sr-only">discourse</label>
35+
</a>
36+
</li>
37+
<li class="nav-item">
38+
<a class="nav-link" href="https://github.com/matplotlib/matplotlib" rel="noopener" target="_blank" title="GitHub">
39+
<span><i class="fab fa-github-square"></i></span>
40+
<label class="sr-only">GitHub</label>
41+
</a>
42+
</li>
43+
<li class="nav-item">
44+
<a class="nav-link" href="https://twitter.com/matplotlib/" rel="noopener" target="_blank" title="twitter">
45+
<span><i class="fab fa-twitter-square"></i></span>
46+
<label class="sr-only">twitter</label>
47+
</a>
48+
</li>
49+
</ul>
50+
{%- endif %}
-12.3 KB
Binary file not shown.

mpl_sphinx_theme/static/images/dask-horizontal-white.svg

Lines changed: 0 additions & 28 deletions
This file was deleted.

mpl_sphinx_theme/theme.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ inherit = pydata_sphinx_theme
33
stylesheet = css/style.css
44

55
[options]
6-
native_site = False
6+
native_site = False
7+
navbar_start = mpl_navbar_logo.html

0 commit comments

Comments
 (0)