docs
docs copied to clipboard
GH-5915 (Open external links in new tab)
Summary
This pull request helps the user open all internal links in the same tab and all the external links in a new tab.
A new open-external-links-in-new-tab.js file has been created. When the dom gets loaded, the target=_blank attribute is applied to all the external links. The JS file has been added to conf.py as well so that the application is aware of that script.
A generated preview of my work is requested (this step is mentioned in the issue).
Ticket Link
Fixes #5915.
Hello @chessmadridista,
Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.
Hey @chessmadridista, thank you for your contribution!
I'm wondering why did you choose to use javascript for this. Is this not doable using a Sphinx extension? I'd rather have the HTML generated with this than adding javascript modifications if possible.
@chessmadridista - I agree with @fmartingr that it's worth exploring whether our HTML generator, Sphinx, can do this for us, rather than modifying the DOM via scripting. Would you be open to looking into Sphinx capabilities in this area? We're currently using Sphinx 7.2.6.
Hi @fmartingr and @cwarnermm, thank you for the feedback!
I was not aware of the solution involving Sphinx extension and the first solution that came to my mind was to manipulate the DOM via JavaScript.
I'll look in the documentation of Sphinx and will make the necessary modifications.
@fmartingr and @cwarnermm
Also, I am contributing to open source for the first time so I am not sure about the process after review.
Should I delete the branch and start afresh with a new branch or should I commit the removal of these JavaScript code snippets and then commit the Sphinx method in this branch or should I do something else? What's the best practice?
@fmartingr and @cwarnermm
Also, I am contributing to open source for the first time so I am not sure about the process after review.
Should I delete the branch and start afresh with a new branch or should I commit the removal of these JavaScript code snippets and then commit the Sphinx method in this branch or should I do something else? What's the best practice?
For me it's fine for you to continue here if needed so we can keep the conversation in one place; commits can be squashed later on merge :)
This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!
Closing due to inactivity.
Hi @fmartingr, @cwarnermm and @amyblais, there is an issue in the Sphinx repo regarding this functionality. It seems that the only way to open external links is to use some form of JS.
Additionally, please take a look at this answer on StackOverflow. They are also saying that there is no inbuilt feature in Sphinx to achieve what we want.
There is an extension on PyPi to achieve the functionality that we want.
Please let me know about the next course of action.