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

Feature Request: Configuration To Open External Links in New Tab #45

Closed
saurabh-sm opened this issue Sep 8, 2023 · 16 comments
Closed

Comments

@saurabh-sm
Copy link

Requesting feature for a configuration which opens external links in a new tab (from discussion #44).

@willfaught
Copy link
Owner

So this would happen for any link anywhere on any page, including the menu, the article body, or the footer?

I'd like to better understand the need for this. Can you describe why/when this would be used?

@saurabh-sm
Copy link
Author

So this would happen for any link anywhere on any page, including the menu, the article body, or the footer?

Yes

I'd like to better understand the need for this. Can you describe why/when this would be used?

Let's say somebody adds an external profile like GitHub, StackOverflow, etc. When a visitor clicks the link which takes them there, they see a lot of things.

For instance on GitHub, there are pinned project, contributions, personal README, etc. And on StackOverflow there is frequently asked questions, answered questions, profile information, most recent votes, saved posts, etc. Some visitors may dive into that content and may not remember to come back to the personal blog, or how many clicks its going to take for them to get back to where they were on the personal blog.

External links like these have a lot of content to "hook" the visitor onto. Opening external links in a new tab is to ensure that the visitor has a way of getting back to the personal blog because there's less distraction, ads, etc. and it's more about the person.

@willfaught
Copy link
Owner

External links like these have a lot of content to "hook" the visitor onto

It sounds like the need is only for "big" links like you described, is that right? Or is there a need to do this for any link, like a link to a definition on dictionary.com or a post on someone's personal blog?

@saurabh-sm
Copy link
Author

I think it's going to be easier to have a configuration flag which opens all external links in a new tab.

"Big" links are going to vary and tough to keep track of. IMO all external links are "big".

@willfaught
Copy link
Owner

This is implemented in v0.67.0. Just published. See the new paige.external_link_new_tab site parameter.

Can you confirm it works for you?

@saurabh-sm
Copy link
Author

saurabh-sm commented Sep 16, 2023

I'm not able to get it to work - I updated the theme and see

module patterns.se

go 1.21.0

require github.com/willfaught/paige v0.68.0 // indirect

in the go.mod file and added

[paige]
color = "#0d6efd" # Bootstrap primary color and theme color for Safari and Windows
external_link_new_tab = true # Open external links in new tabs
math = false # Enable math typesetting

at the bottom of the config file.

@willfaught
Copy link
Owner

What is your base url and external link?

@willfaught
Copy link
Owner

Also, what is the link syntax? Markdown or html?

@saurabh-sm
Copy link
Author

saurabh-sm commented Sep 16, 2023

What is your base url and external link?

It's a website on a different domain. Navigation is from patterns.se to saurabh.sm and creativecommons.org and is happening in the footer. This is the repository URL.

Also, what is the link syntax? Markdown or html?

Markdown:

@willfaught
Copy link
Owner

I've been delayed looking into this because I picked up a new feature right before the problem was reported. Will work on this afterward.

@saurabh-sm
Copy link
Author

Sure, thanks Will !

@willfaught
Copy link
Owner

external_link_new_tab belongs under params.paige, but you have just paige. You want this:

[params.paige]
external_link_new_tab = true

@willfaught
Copy link
Owner

@saurabh-mish Can you confirm that fixes the issue?

@saurabh-sm
Copy link
Author

saurabh-sm commented Oct 5, 2023

Hi @willfaught

Yes it works !!

external_link_new_tab belongs under params.paige, but you have just paige.

Thanks a lot for pointing this out !!

[params.paige]
external_link_new_tab = true

Looks like this is not present is the README. Currently it looks like this

@willfaught
Copy link
Owner

Looks like this is not present is the README. Currently it looks like this

That documents the configuration object shared by the site and pages:

There is a single parameter object with sensible defaults that can be overridden in site or page parameters:

In page front matter, it appears like this:

+++
[paige]
external_link_new_tab = true
+++

In site configuration, it appears like this:

[params.paige]
external_link_new_tab = true

@willfaught
Copy link
Owner

@saurabh-mish I added a line to the readme that should clarify this: e4c6b38. Thanks for the feedback.

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

No branches or pull requests

2 participants