Skip to content

Commit

Permalink
Added external_links theme option
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulko committed Oct 1, 2019
1 parent 1984cdd commit 4bbde56
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
19 changes: 16 additions & 3 deletions docs/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,30 @@ See docs on `html_sidebars <http://www.sphinx-doc.org/en/master/usage/configurat
html_sidebars = {'**': ['util/searchbox.html', 'util/sidetoc.html']}
html_css_files
^^^^^^^^^^^^^^
``html_css_files``
^^^^^^^^^^^^^^^^^^

Adds custom CSS files to the theme:

.. code-block:: python
html_css_files = ["css/custom.css"]
``html_external_links``
^^^^^^^^^^^^^^^^^^^^^^^

If provided, creates external links (e.g. Github) in the top right corner:

.. code-block:: python
html_theme_options = {
"external_links": [
("Github", "https://github.com/username/repo"),
("Other", "https://bla.com")
]
}
templates
Templates
=========


Expand Down
1 change: 1 addition & 0 deletions sphinx_press_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ sidebars = util/searchbox.html, util/sidetoc.html

[options]
analytics_id =
external_links =
18 changes: 10 additions & 8 deletions sphinx_press_theme/util/extlinks.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{# external links, i.e. #}
{#
<div class="nav-item">
<a href="https://github.com/schettino72/sphinx_press_theme"
class="nav-link external">
Github <outboundlink/>
</a>
</div>
#}
{% if theme_external_links %}
{% for (label, url) in theme_external_links %}
<div class="nav-item">
<a href="{{ url }}"
class="nav-link external">
{{ label }} <outboundlink/>
</a>
</div>
{% endfor %}
{% endif %}

0 comments on commit 4bbde56

Please sign in to comment.