Update external_links.js to fix link behavior on MASVS page #2475
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When you open https://mas.owasp.org/MASTG/ you will notice that external links (like github repo for example) will have small arrow icon and _blank attribute that will open the link in the new tab. But https://mas.owasp.org/MASVS/ page doesn't have the same behavior.
This PR modifies the code to enhance the user experience on the MASVS page (https://mas.owasp.org/MASVS/) by ensuring that external links open in a new tab, similar to the behavior on the MASTG page (https://mas.owasp.org/MASTG/).
This change involves updating the checking if the path starts with '/MASTG' or '/MASVS' and applying the necessary attributes to external links accordingly. It also add
document$.subscribe()
so the code still executed when page navigate (reference: squidfunk/mkdocs-material#5816)Thank you for submitting a Pull Request to the OWASP MASTG. Please make sure that:
If your PR is related to an issue. Please end your PR test with the following line:
This PR closes #< insert number here >.