You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2026/02/09 14:17:03 UTC
(cordova-docs) branch pr-fix-highlight-toc-entries-without-sub-entries created (now 29486b5220)
This is an automated email from the ASF dual-hosted git repository.
manuelbeck pushed a change to branch pr-fix-highlight-toc-entries-without-sub-entries
in repository https://gitbox.apache.org/repos/asf/cordova-docs.git
at 29486b5220 fix(toc): highlight toc entries without sub-entries
This branch includes the following new commits:
new 29486b5220 fix(toc): highlight toc entries without sub-entries
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
(cordova-docs) 01/01: fix(toc): highlight toc entries without sub-entries
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
manuelbeck pushed a commit to branch pr-fix-highlight-toc-entries-without-sub-entries
in repository https://gitbox.apache.org/repos/asf/cordova-docs.git
commit 29486b52206c128be8fc3cb5aafdd1ca7421eeb7
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Mon Feb 9 15:16:53 2026 +0100
fix(toc): highlight toc entries without sub-entries
- Fix an issue where menu entries weren't being highlighted or scrolled to when navigating between documentation pages, particularly affecting nested entries without children (e.g., "Security" under "Security & Privacy").
- Normalize URLs to handle Jekyll's pretty URLs (e.g., "path/") vs TOC entry URLs (e.g., "path/index.html") for proper comparison
- Add validation to prevent false matches on pages without URLs
- Fixes: https://github.com/apache/cordova-docs/issues/1417
- Generated-By: Claude Sonnet 4.5
---
www/_includes/toc_recursive_main.html | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/www/_includes/toc_recursive_main.html b/www/_includes/toc_recursive_main.html
index b42d50dcef..e39d37426d 100644
--- a/www/_includes/toc_recursive_main.html
+++ b/www/_includes/toc_recursive_main.html
@@ -1,16 +1,25 @@
<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", "/" | 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 %}
@@ -18,7 +27,7 @@
{% 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 %}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org