relative links are broken on the training resources page because of javascript
on the new training resources and digital security resources pages, relative links break when using javascript filtering.
the filtering system i created for #265 (closed) uses javascript to filter visible resources. the javascript also uses the browser history api to modify the current URL, so that a user filtering for resources in spanish can easily share the URL with others who will be brought directly to that filtered view.
the problem: by default, lektor uses relative URLs. relative URLs break when you use the history api to change the current URL. this only affects users who visit the main /training/resources
page, then filter with javascript. users visiting /training/resources/sortby/<topic>/<language>/<maintainer>
aren't affected, and users without javascript aren't affected
how to reproduce:
- ensure you have javascript enabled
- visit https://community.torproject.org/training/digital-security-guides/. the sidebar links to things like
../resources
, which points to/training/resources
- change the filters to only view spanish-language resources. your URL should now be https://community.torproject.org/training/digital-security-guides/sortby/none/es/none
- the relative sidebar links are still
../resources
, which now points to/training/digital-security-guides/sortby/none/es/resources
possible fixes:
- remove js filtering. the js-free filtering will still work, but will require another page load to load the new page with the visible resources filtered
- have the js filtering find all the anchor tags with relative links, and rewrite them
- add a base tag to these pages that points to
https://community.torproject.org/training/digital-security-guides/
orhttps://community.torproject.org/training/resources/