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

chore(SEO): Sanitze zone names in URL #7407

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

VIKTORVAV99
Copy link
Member

Issue

In some online platforms when you write a link like this https://app.electricitymaps.com/DK-DK1: Denmark, the colon is included which breaks the links. Similar problems can occur with (https://app.electricitymaps.com/DK-DK2) causing the trailing parentheses to be included in the link.

Description

In order to avoid this I added a regex that only allows the zoneID to contain, letters, numbers and - which we use as a subzone delimiter. This should resolve the issue quite nicely.

I also took to opportunity to clean up the code a bit so it handles more things internally and not potentially causing multiple navigations requests. So instead of going aus -> AUS -> AU it simply goes aus -> AU.

Double check

  • I have run pnpx prettier@2 --write . and poetry run format in the top level directory to format my changes.

Copy link
Collaborator

@tonypls tonypls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@VIKTORVAV99 VIKTORVAV99 merged commit 3a842fa into master Nov 13, 2024
24 checks passed
@VIKTORVAV99 VIKTORVAV99 deleted the vik/sanitize_zone_name_from_URL branch November 13, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants