dheeraj12347 opened a new pull request, #1463:
URL: https://github.com/apache/cordova-docs/pull/1463
## Problem
Table of Contents (TOC) highlighting is not working correctly for some pages.
## Root Cause
The URL comparison logic in `toc_recursive_main.html` and
`toc_recursive_dropdown.html` was failing due to trailing slash differences
between `include.my_entry` and `entry.url`.
Example:
- include.my_entry: `/docs/api/`
- entry.url: `/docs/api`
These look the same but don't match as strings.
## Solution
Normalize both URLs before comparison by removing trailing slashes using
Jekyll's `remove` filter.
Added:
```liquid
{% assign normalized_my_entry = include.my_entry | remove: '/' %}
{% assign normalized_entry_url = entry.url | remove: '/' %}
## Solution
Normalize both URLs before comparison by removing trailing slashes using
Jekyll's `remove` filter.
Added:
```liquid
{% assign normalized_my_entry = include.my_entry | remove: '/' %}
{% assign normalized_entry_url = entry.url | remove: '/' %}
Then compare:
text
{% if normalized_my_entry == normalized_entry_url %}
Files Changed
www/_includes/toc_recursive_main.html
www/_includes/toc_recursive_dropdown.html
Why This Works
Removes all / characters from both URLs before comparison
Makes the comparison consistent regardless of trailing slashes
Current page highlighting now works correctly
No JavaScript changes needed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]