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

Update redirect file #3047

Merged
merged 5 commits into from
Feb 5, 2025
Merged

Update redirect file #3047

merged 5 commits into from
Feb 5, 2025

Conversation

archiewood
Copy link
Member

@archiewood archiewood commented Jan 27, 2025

Description

Some of our redirects appear to be failing on the docs site eg

https://docs.evidence.dev/deployment/evidence-cloud/

However others are working eg

https://docs.evidence.dev/markdown

I assume whitespace is the cuprit

The alternative option is that it is trailing slashes

Checklist

  • For UI or styling changes, I have added a screenshot or gif showing before & after
  • I have added a changeset
  • I have added to the docs where applicable
  • I have added to the VS Code extension where applicable

@zachstence
Copy link
Member

Some of our redirects appear to be failing on the docs site eg
https://docs.evidence.dev/evidence-cloud

@archiewood The whitespace shouldn't have any affect. There isn't a redirect for /evidence-cloud, that's why that particular one isn't working.

@archiewood
Copy link
Member Author

archiewood commented Jan 27, 2025

Apologies, I added the wrong link: https://docs.evidence.dev/deployment/evidence-cloud/

There are also multiple other examples

https://docs.evidence.dev/components/area-chart/

@archiewood
Copy link
Member Author

archiewood commented Jan 27, 2025

okay so @zachstence I think you are right that it is not whitespace. I think it must be trailing slash

https://docs.evidence.dev/components/area-chart/ broken
https://docs.evidence.dev/components/area-chart works

@zachstence
Copy link
Member

@archiewood Regex might be a good solution here

For example:

{
  "redirects": [
    {
      "source": "^/a/?$",
      "destination": "/b",
      "permanent": true
    }
  ]
}

The source regex matches any URL that begins with (^) /a and optionally ends with (?$) /, and redirects to the destination /b.

So for https://docs.evidence.dev/components/area-chart it would look something like:

{
  "redirects": [
    {
      "source": "^/components/area-chart/?$",
      "destination": "/components/charts/area-chart",
      "permanent": true
    }
  ]
}

@archiewood
Copy link
Member Author

@zachstence I think I'm going to brute force this for simplicity

@archiewood archiewood merged commit fd7477f into next Feb 5, 2025
36 of 40 checks passed
@archiewood archiewood deleted the update-redirect-file branch February 5, 2025 20:13
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.

3 participants