-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: adds option to open aux links in new tab #229
Conversation
_layouts/default.html
Outdated
{% if site.aux_links_new_tab %} | ||
<a href="{{ link.last }}" target="_blank" rel="noopener noreferrer"> | ||
{% else %} | ||
<a href="{{ link.last }}"> | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could write it like this:
<a href="{{ link.last }}"{% if site.aux_links_new_tab != false %} target="_blank" rel="noopener noreferrer"{% endif %}>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's a bit cleaner. Updated the branch!
Would anyone be available to review and merge this PR? It would be very useful for a project I'm working on. Thanks! |
I think @pmarsceill's been pretty busy w/ other work, but doesn't hurt to ping him again. If it's super critical, you can download the fork and use the theme directly from there! |
Create ci-master.yml
Ignore the failing CI check, I have to fix how GH Actions implements the formatting changes from Prettier. |
Haha, no worries, just been periodically updating the branch to match base. |
This is a great addition -- only thing is maybe we should add an icon like: https://feathericons.com/?query=external-link if the feature is enabled? |
Sure, is feather icons the normal icon set that's used for just-the-docs? I can probably implement that pretty quickly! |
Actually, on second thought, isn't an icon like that normally used just to indicate that a link is external? I'm not sure if this option should change that behaviour. Also a bit worried about visual clutter in the nav? |
Yeah you're probably right. I think this is good as-is. |
I'm going to merge into the 2.9 branch. Thanks! |
Hey! This is a simple PR that implements the feature requested in #165, namely some way to make aux links open in a new tab.
_config.yml
calledaux_links_new_tab
, and if it's set to true, aux links will open in a new tab viatarget="_blank"
rel="noopener noreferrer"
for security reasonsaux_links_new_tab
is set to false by default to maintain the previous behaviour before this PRLet me know what you think! I'm not super proud of the semi-janky if statement in the header, and if there's a better way to implement it I'm happy to change it.
closes #165