Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trailing slash to current_url to fix matching URLs without trailing slash #1785

Merged
merged 8 commits into from
Feb 23, 2024

Conversation

pedro-mendonca
Copy link
Member

Problem

Navigating to a page like site.com/glotpress/projects without the trailing slash won't identify the current page in the top menu.

Solution

Add trailing slash when trying to match menu items to show the current one.

Fixes #1784

@swissspidy
Copy link
Member

This makes sense to me 👍

Every once in awhile I install GlotPress again and get 404s because I forget the slashes.

@pedro-mendonca
Copy link
Member Author

This PR actually doesn't fix that.
In the related issue I mention that, this is currently fixing only the matching of the url with or without slash for the menu item bottom border of the current menu.

@swissspidy
Copy link
Member

Oh, gotcha!

@pedro-mendonca
Copy link
Member Author

As discussed with @amieiro, changed the approach to check for trailing slash in the URL as soon as possible.
If doesn't exist, redirect to trailingslash URL.

@swissspidy:

Every once in awhile I install GlotPress again and get 404s because I forget the slashes.

This PR actually doesn't fix that.
In the related issue I mention that, this is currently fixing only the matching of the url with or without slash for the menu item bottom border of the current menu.

With the current approach change, this PR actually solves the issue of 404s :)

@amieiro amieiro enabled auto-merge (squash) February 23, 2024 16:54
@amieiro amieiro merged commit 1dbec8b into GlotPress:develop Feb 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URLs without ending slash aren't fully recognized
3 participants