Skip to content
Merged
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
12 changes: 11 additions & 1 deletion www/_includes/toc_recursive_dropdown.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{% for entry in include.entries %}

{% comment %}Normalize URLs for comparison: my_entry may be "path/" while entry.url is "path/index.html"{% endcomment %}
{% assign normalized_entry_url = entry.url | replace: "index.html", "" %}
{% assign is_current_page = false %}
{% if entry.url and entry.url != "" and include.my_entry and include.my_entry != "" %}
{% if include.my_entry == entry.url or include.my_entry == normalized_entry_url %}
{% assign is_current_page = true %}
{% endif %}
{% endif %}

{% if entry.url != null %}
<li>
<a class="{% if include.my_entry == entry.url %}this-page{% endif %}" href="{{ include.path_to_root }}{{ entry.url }}">
<a class="{% if is_current_page %}this-page{% endif %}" href="{{ include.path_to_root }}{{ entry.url }}">
{{ entry.name }}
</a>
</li>
Expand Down
15 changes: 12 additions & 3 deletions www/_includes/toc_recursive_main.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<ul class="site-toc">
{% for entry in include.entries %}

{% comment %}Normalize URLs for comparison: my_entry may be "path/" while entry.url is "path/index.html"{% endcomment %}
{% assign normalized_entry_url = entry.url | replace: "index.html", "" %}
{% assign is_current_page = false %}
{% if entry.url and entry.url != "" and include.my_entry and include.my_entry != "" %}
{% if include.my_entry == entry.url or include.my_entry == normalized_entry_url %}
{% assign is_current_page = true %}
{% endif %}
{% endif %}

<li>
{% if entry.children %}
<span class="toc-section-heading">
{{ entry.name }}
</span>
{% else %}
<a class="{% if include.my_entry == entry.url %}this-page{% endif %}" href="{{ include.path_to_root }}{{ entry.url }}">
<a class="{% if is_current_page %}this-page{% endif %}" href="{{ include.path_to_root }}{{ entry.url }}">
{{ entry.name }}
</a>
{% if include.my_entry == entry.url %}
{% if is_current_page %}
<span class="entry-highlight"></span>
{% endif %}
{% endif %}

{% comment %}
Insert page-specific ToC here if this is the entry for this page
{% endcomment %}
{% if include.my_entry == entry.url %}<div id="page-toc" class="page-toc"></div>{% endif %}
{% if is_current_page %}<div id="page-toc" class="page-toc"></div>{% endif %}

{% if entry.children %}
{% include toc_recursive_main.html entries=entry.children my_entry=include.my_entry path_to_root=include.path_to_root %}
Expand Down