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 external_links.js to fix link behavior on MASVS page #2475

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

rmRizki
Copy link
Contributor

@rmRizki rmRizki commented Dec 19, 2023

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:

  • Your contribution is written in the 2nd person (e.g. you)
  • Your contribution is written in an active present form for as much as possible.
  • You have made sure that the reference section is up to date (e.g. please add sources you have used, make sure that the references to MITRE/MASVS/etc. are up to date)
  • Your contribution has proper formatted markdown and/or code
  • Any references to website have been formatted as [TEXT](URL “NAME”)
  • You verified/tested the effectiveness of your contribution (e.g.: is the code really an effective remediation? Please verify it works!)

If your PR is related to an issue. Please end your PR test with the following line:
This PR closes #< insert number here >.

rmRizki and others added 2 commits December 19, 2023 08:04
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.
@cpholguera
Copy link
Collaborator

Thanks @rmRizki, we'll take a look soon!

Copy link
Collaborator

@cpholguera cpholguera left a comment

Choose a reason for hiding this comment

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

Excellent work @rmRizki, thank you very much!

@cpholguera cpholguera merged commit 560da51 into OWASP:master Feb 7, 2024
3 of 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.

2 participants