Skip to content

Commit ef875d9

Browse files
committed
adding configuration page and a few options
1 parent cf2ed47 commit ef875d9

File tree

6 files changed

+111
-14
lines changed

6 files changed

+111
-14
lines changed

docs/conf.py

+11
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@
5353
html_theme = 'pandas_sphinx_theme'
5454
html_logo = '_static/pandas.svg'
5555

56+
html_theme_options = {
57+
"external_links": [
58+
{
59+
'url': "https://github.com",
60+
"name": "GitHub"
61+
}
62+
],
63+
"github_url": "https://github.com/pandas-dev/pandas-sphinx-theme",
64+
"twitter_url": "https://twitter.com/pandas_dev",
65+
}
66+
5667
# Add any paths that contain custom static files (such as style sheets) here,
5768
# relative to this directory. They are copied after the builtin static files,
5869
# so a file named "default.css" will overwrite the builtin "default.css".

docs/user_guide/configuring.rst

+46-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,49 @@
22
Configuration
33
*************
44

5-
TODO
5+
There are a number of options for configuring your site's look and feel.
6+
All configuration options are passed with the ``html_theme_options`` variable
7+
in your ``conf.py`` file. This is a dictionary with ``key: val`` pairs that
8+
you can configure in various ways. This page describes the options available to you.
9+
10+
Configure social media buttons
11+
==============================
12+
13+
If you'd like social media buttons to show up to the right of your nav bar, use the
14+
following configuration:
15+
16+
.. code:: python
17+
18+
html_theme_options: {
19+
"github_url": "https://github.com/<your-org>/<your-repo>",
20+
"twitter_url": "https://twitter.com/<your-handle>",
21+
}
22+
23+
Adding external links to your nav bar
24+
=====================================
25+
26+
You can add external links to your navigation bar. These will show up to the right
27+
of your site's main links, and will have a small icon indicating that they point to
28+
an external site. You can add external links to the nav bar like so:
29+
30+
.. code:: python
31+
32+
html_theme_options: {
33+
"external_links": [
34+
"https://<link-one>",
35+
"https://<link-two>"
36+
]
37+
}
38+
39+
40+
Hiding the previous and next buttons
41+
====================================
42+
43+
By default, each page of your site will have "previous" and "next" buttons
44+
at the bottom. You can hide these buttons with the following configuration:
45+
46+
.. code:: python
47+
48+
html_theme_options: {
49+
"show_prev_next": False
50+
}

pandas_sphinx_theme/docs-navbar.html

+19-10
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,26 @@
1919
<a class="nav-link" href="{{ main_nav_item.url }}">{{ main_nav_item.title }}</a>
2020
</li>
2121
{% endfor %}
22-
</ul>
23-
<ul class="navbar-nav ml-auto">
24-
<li class="nav-item">
25-
<a class="nav-link" href="https://github.com/pandas-dev/pandas" target="_blank" rel="noopener">
26-
<span><i class="fab fa-github-alt" style="color:#333;font-size:1rem;line-height:1.25"></i></span>
27-
</a>
28-
</li>
22+
{% for external_link in theme_external_links %}
2923
<li class="nav-item">
30-
<a class="nav-link" href="https://twitter.com/pandas_dev" target="_blank" rel="noopener">
31-
<span><i class="fab fa-twitter" style="color:#55acee;font-size:1rem;line-height:1.25"></i></span>
32-
</a>
24+
<a class="nav-link nav-external" href="{{ external_link.url }}">{{ external_link.name }}</a>
3325
</li>
26+
{% endfor %}
27+
</ul>
28+
<ul class="navbar-nav ml-auto">
29+
{% if theme_github_url | length > 2 %}
30+
<li class="nav-item">
31+
<a class="nav-link" href="{{ theme_github_url }}" target="_blank" rel="noopener">
32+
<span><i class="fab fa-github-square" style="color:#333;font-size:1rem;line-height:1.25"></i></span>
33+
</a>
34+
</li>
35+
{% endif %}
36+
{% if theme_twitter_url | length > 2 %}
37+
<li class="nav-item">
38+
<a class="nav-link" href="{{ theme_twitter_url }}" target="_blank" rel="noopener">
39+
<span><i class="fab fa-twitter-square" style="color:#55acee;font-size:1rem;line-height:1.25"></i></span>
40+
</a>
41+
</li>
42+
{% endif %}
3443
</ul>
3544
</div>

pandas_sphinx_theme/layout.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
{%- block css %}
1515
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
16-
{{- css() }}
16+
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
17+
18+
{{- css() }}
1719
<link href="{{ pathto('_static/css/custom.css', 1) }}" rel="stylesheet">
1820
{%- endblock %}
1921

@@ -58,9 +60,11 @@
5860
<div>
5961
{% block body %} {% endblock %}
6062
</div>
63+
{% if theme_show_prev_next %}
6164
<div class='prev-next-bottom'>
6265
{{ prev_next(prev, next) }}
6366
</div>
67+
{% endif %}
6468
</main>
6569

6670
</div>

pandas_sphinx_theme/static/css/custom.css

+25-1
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ body {
248248
border-style: none;
249249
}
250250

251+
.nav-external:after {
252+
font-family: 'FontAwesome';
253+
font-size: 0.7rem;
254+
vertical-align: middle;
255+
content: " \f08e";
256+
}
257+
251258

252259
/* Collapsing of the TOC sidebar while scrolling */
253260

@@ -288,4 +295,21 @@ div.prev-next-bottom a.right-next {
288295

289296
div.prev-next-bottom a.right-next:after {
290297
content: " >>"
291-
}
298+
}
299+
300+
/* Social media buttons */
301+
302+
i.fab:before {
303+
font-family: 'FontAwesome';
304+
vertical-align: middle;
305+
font-style: normal;
306+
font-size: 1.5rem;
307+
}
308+
309+
i.fa-github-square:before {
310+
content: "\f092";
311+
}
312+
313+
i.fa-twitter-square:before {
314+
content: "\f081";
315+
}

pandas_sphinx_theme/theme.conf

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ pygments_style = tango
55

66
[options]
77
sidebarwidth = 270
8-
sidebar_includehidden = True
8+
sidebar_includehidden = True
9+
external_links = []
10+
github_url = ''
11+
twitter_url = ''
12+
show_prev_next = True

0 commit comments

Comments
 (0)