Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,22 @@ your "conf.py" file::
# (name, "http://example.com", True) # arbitrary absolute url
# Note the "1" or "True" value above as the third argument to indicate
# an arbitrary url.
# You can create a menu of links by making the name '_menu' and
# providing a list of links or '_divider' to add a divider.
# ("_menu", name, [
# ("Examples", "examples"),
# ("_divider", ),
# ("Link", "http://example.com", True),
# ])

'navbar_links': [
("Examples", "examples"),
("Link", "http://example.com", True),
("_menu", "Example Menu", [
("Examples", "examples"),
("_divider", ),
("Link", "http://example.com", True),
]),
],

# Render the next and previous page links in navbar. (Default: true)
Expand Down
17 changes: 16 additions & 1 deletion sphinx_bootstrap_theme/bootstrap/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@
<ul class="nav navbar-nav">
{% if theme_navbar_links %}
{%- for link in theme_navbar_links %}
<li><a href="{{ pathto(*link[1:]) }}">{{ link[0] }}</a></li>
{% if link[0] == "_menu" %}
<li class="dropdown">
<a role="button" id="{{ link[1] }}Toc" data-toggle="dropdown" data-target="#" href="#" aria-expanded="false">{{ link[1] }} <b class="caret"></b></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="{{ link[1] }}Toc">
{%- for sublink in link[2] %}
{% if sublink[0] == "_divider" %}
<li class="divider"></li>
{% else %}
<li><a href="{{ pathto(*sublink[1:]) }}">{{ sublink[0] }}</a></li>
{% endif %}
{%- endfor %}
</ul>
</li>
{% else %}
<li><a href="{{ pathto(*link[1:]) }}">{{ link[0] }}</a></li>
{% endif %}
{%- endfor %}
{% endif %}
{% block navbartoc %}
Expand Down