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

fix(docs): check for trailing slash in pathname #4214

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

evwilkin
Copy link
Member

@evwilkin evwilkin commented Aug 22, 2024

Closes #4210

Alternate PR preview link: http://pr-4210.surge.sh/design-foundations/about-design-foundations/

This PR resolves the section gallery pages (ex: All components, Design foundations, etc) from displaying an extra card linking back to the current page by adding one additional check for a trailing / after at the end of the pathname.

The slug is the end of the page URL (ex: /components/all-components) which should work as expected when navigating to the page from a link, but refreshing the page can add a trailing slash (/components/all-components/) so this is a 1-liner adding a check for that slash:

!location.pathname.endsWith(slug) &&
!location.pathname.endsWith(`${slug}/`) &&

@patternfly-build
Copy link
Contributor

patternfly-build commented Aug 22, 2024

@nicolethoen nicolethoen merged commit ff4c44d into patternfly:main Sep 17, 2024
4 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.

Bug - Section overview pages get an empty tile for themselves on reload
4 participants