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

[v2] links: nav & footer links (href) without target="_blank" #2339

Closed
LukasGentele opened this issue Feb 27, 2020 · 6 comments · Fixed by #2344
Closed

[v2] links: nav & footer links (href) without target="_blank" #2339

LukasGentele opened this issue Feb 27, 2020 · 6 comments · Fixed by #2344
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@LukasGentele
Copy link
Contributor

🚀 Feature

Currently, I can set href for nav and footer links in docusaurus.config.js for the classic-theme but they always render with target="_blank". It would be great if that could be disabled/changed, so that the link will open in the current browser tab rather than opening a new one.

Have you read the [Contributing Guidelines on issues]

Yes

Motivation

I think it is such an essential thing that it should be part of the classic-theme. I mean I could eject the header and footer and just do it myself but that would disconnect me from the theme which seems a little overpowered for such a small change.

Pitch

There could be a config option next to href to control the target, e.g. linkTarget with a default value of _blank or an option targetBlank with default value true.

@LukasGentele LukasGentele added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Feb 27, 2020
@lex111
Copy link
Contributor

lex111 commented Feb 28, 2020

You can add the target property, and thereby override the default value, eg:

{
  href: 'https://github.com/facebook/docusaurus',
  label: 'GitHub',
  position: 'right',
  target: '_self',
},

@lex111 lex111 closed this as completed Feb 28, 2020
@LukasGentele
Copy link
Contributor Author

Thanks, @lex111. Any way this is possible for the navbar.logo option as well? Adding target does not seem to do anything for the logo option.

@lex111
Copy link
Contributor

lex111 commented Feb 28, 2020

Is it really necessary for a logo? I mean, do you really want external link to open in the current tab when you click on the logo? FYI was recently allowed to add an external link to logo.href, in which case it will open in a new tab (as expected).
If you mean that the internal link in the logo opens in a new tab, then this is also a rather strange behavior and is not familiar to most users.
We focus on the expected UX - this is when external links open in a new tab, and all the rest in the current one.

@LukasGentele
Copy link
Contributor Author

LukasGentele commented Feb 28, 2020

Got it but in my case it is expected actually and currently, it is very strange from a UX perspective. You can see what I mean here: https://devspace.sh/cli/docs/introduction

To explain what happens here: I have a website hosted on netlify and I only proxy the /docs/* routes to the docusaurus page => That means the / route is not made with docusaurus. However, using a to link, would load the wrong site using javascript. So, I need an href link but with target=_self. I actually want to make the header of the page I linked above similar to the one in the docs and remove the Website link in the nav bar but that would be even less intuitive at this point.

@lex111
Copy link
Contributor

lex111 commented Feb 28, 2020

Hmm, aha, if you set navbar.logo.href as '/' then this will not work, there will be a 404 error. This is actually not a common use case. But it seems to me, we can add the ability to set the target attribute for logo url 🤔.

@LukasGentele
Copy link
Contributor Author

Yes, exactly. I got the 404 with to:/, so I switched to using href. Having logo.target would be great. Let me know if you want a PR for this.

@lex111 lex111 reopened this Feb 29, 2020
@lex111 lex111 added this to the v2.0.0-alpha.44 milestone Feb 29, 2020
@lex111 lex111 removed the status: needs triage This issue has not been triaged by maintainers label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants