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

Automatically open links to new tab #743

Merged
merged 2 commits into from
Apr 12, 2024
Merged

Automatically open links to new tab #743

merged 2 commits into from
Apr 12, 2024

Conversation

howardbaik
Copy link
Contributor

@howardbaik howardbaik commented Apr 8, 2024

(Used this blogpost as a reference)

I added JS code to assets/open-new-tab.html inside the <script> tag, and pointed this file out to bookdown by placing it in the appropriate field inside _output.yml.

I tested this works by running bookdown::render_book() and clicking on the links on the rendered HTML pages.

Screen.Recording.2024-04-08.at.12.08.03.PM.mov

My only question is after running bookdown::render_book(), I get a bunch of rendered files in docs/, and I'm not sure whether I need to include the below files in this PR?

Screenshot 2024-04-08 at 12 10 51 PM

@howardbaik howardbaik linked an issue Apr 8, 2024 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Apr 8, 2024

No broken url errors! 🎉
Comment updated at 2024-04-08-19:11:45 with changes from 3d933ff

Copy link
Contributor

github-actions bot commented Apr 8, 2024

No spelling errors! 🎉
Comment updated at 2024-04-08-19:11:47 with changes from 3d933ff

Copy link
Contributor

github-actions bot commented Apr 8, 2024

Re-rendered previews from the latest commit:

* note not all html features will be properly displayed in the "quick preview" but it will give you a rough idea.

Updated at 2024-04-08 with changes from the latest commit 3d933ff

@howardbaik
Copy link
Contributor Author

Weird that in the GHA generated preview of the course website, the links do NOT open in new tab.

Copy link
Collaborator

@cansavvy cansavvy left a comment

Choose a reason for hiding this comment

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

@howardbaek This is an excellent and much needed ad! Thanks so much for figuring this out in a way that's succinct.

@howardbaik
Copy link
Contributor Author

@cansavvy I have one followup question. After running bookdown::render_book(), I get a bunch of rendered files in docs/, and I'm not sure whether I need to include the below files in this PR?

image

@cansavvy
Copy link
Collaborator

@cansavvy I have one followup question. After running bookdown::render_book(), I get a bunch of rendered files in docs/, and I'm not sure whether I need to include the below files in this PR?

image

No. Don't commit those files to the PR! The files will be re-rendered after this PR is merged.

@cansavvy cansavvy merged commit bac0bdb into main Apr 12, 2024
9 checks passed
@cansavvy cansavvy deleted the 227-links-to-new-tab branch April 12, 2024 13:31
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.

links to new tab
2 participants