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

Script: generate list of redirect URLs #8086

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

internetisaiah
Copy link
Contributor

@internetisaiah internetisaiah commented Sep 16, 2024

Summary

For each new redirect in the current branch, this script uses the user-supplied base URL to list all old URLs so the user can open old links directly from the terminal to test redirects.

Related PRs, issues, or features (optional)

  • N/A

Feature release date (optional)

  • N/A

Contributor checklist

  • I confirm that my PR meets the following:
    • I signed the Contribution License Agreement (CLA).
    • My style and voice follows the Braze Style Guide.
    • My content contains correct spelling and grammar.
    • All links are working correctly.
    • If I renamed or moved a file or directory, I set up URL redirects for each file.
    • If I updated or replaced an image, I did not remove the original image file from the repository. (For more information, see Updating an image).
    • If my PR is related to a paid SKU, third party, SMS, AI, or privacy, I have received written approval from Braze Legal.

Submitting for review

If your PR meets the above requirements, select Ready for review, then add a reviewer:

  • Non-Braze contributors: Add braze-inc/docs-team as the reviewer.
  • Braze employees: Have any relevant subject matter experts (like engineers or product managers) review your work first, then add the tech writer assigned to your specific vertical. If you're not sure which tech writer to add, you can add braze-inc/docs-team instead.

Thanks for contributing! We look forward to reading your work.

@internetisaiah
Copy link
Contributor Author

internetisaiah commented Sep 16, 2024

Hi @rachel-feinberg @lydia-xie , only need one person to test. No rush!

To test:

  1. Checkout this branch and pull.
  2. Run: ./bdocs redirects > it should throw an error because no changes were made to the redirect file in this branch.
  3. Add some random urls to the redirect file and save changes (you could literally just copy 2-3 from earlier in the file and add them to the bottom), then run ./bdocs redirects again and follow the prompts.
  4. Check that the generated URLs match the first half of the redirect URL syntax. i.e.:

Redirect file:

validurls['/docs/partners/data_and_infrastructure_agility/ab_testing/phrasee/phrasee#phrasee'] = '/docs/partners/data_and_infrastructure_agility/ab_testing/jacquard/';
validurls['/docs/partners/data_and_infrastructure_agility/ab_testing/jacquard/jacquard/'] = '/docs/partners/data_and_infrastructure_agility/ab_testing/jacquard/';
validurls['/docs/partners/data_and_infrastructure_agility/ab_testing/jacquard/jacquard_react/'] = '/docs/partners/data_and_infrastructure_agility/ab_testing/jacquard/';

Output of script:

BASE_URL/docs/partners/data_and_infrastructure_agility/ab_testing/phrasee/phrasee#phrasee
BASE_URL/docs/partners/data_and_infrastructure_agility/ab_testing/jacquard/jacquard/
BASE_URL/docs/partners/data_and_infrastructure_agility/ab_testing/jacquard/jacquard_react/

Note: If you're using VS Code, hold CMD then click a link in your terminal and it should auto-open the link in your chrome browser (or whatever your default browser is).

@rachel-feinberg
Copy link
Contributor

Screenshot 2024-09-16 at 3 10 40 PM

Copy link
Contributor

@rachel-feinberg rachel-feinberg left a comment

Choose a reason for hiding this comment

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

Works for me!

@internetisaiah internetisaiah merged commit f92ee4b into develop Sep 16, 2024
3 checks passed
@internetisaiah internetisaiah deleted the generate-redirect-urls-script branch September 16, 2024 22:38
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