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

Links open in the new tab #71

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

zzzsyyy
Copy link

@zzzsyyy zzzsyyy commented Feb 21, 2021

Open the vast majority of non-internal links in a new tab
add target = "_blank"

reference :#6545

@zzzsyyy zzzsyyy changed the title Create render-link.html Links open in the new tab Feb 21, 2021
@wangchucheng
Copy link
Owner

wangchucheng commented Mar 12, 2021

Thanks for this PR! Sorry for the late reply because there are many personal affairs after the Chinese New Year.

People have different opinions about when to open a new window, but this is indeed a useful feature in some situations. I think we can make it configurable.

Copy link

@RobbiNespu RobbiNespu left a comment

Choose a reason for hiding this comment

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

The alternative and shorter (one line) is doing like this

<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | markdownify }}</a>

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.

None yet

3 participants