mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-12 21:03:32 -06:00
Add configuration options for opening external links in new tab (#1360)
I've whipped up a solution that solves #1103. I've added a config option `nav_external_links_new_tab`, which is off by default. When turned on, it'll pop external nav links into a new tab. The idea was borrowed from how [aux_nav.html](https://github.com/just-the-docs/just-the-docs/blob/main/_includes/components/aux_nav.html) does it with `aux_links_new_tab`. --------- Co-authored-by: Matt Wang <matt@matthewwang.me>
This commit is contained in:
@@ -271,11 +271,19 @@ nav_external_links:
|
||||
- title: Just the Docs on GitHub
|
||||
url: https://github.com/just-the-docs/just-the-docs
|
||||
hide_icon: false # set to true to hide the external link icon - defaults to false
|
||||
opens_in_new_tab: false # set to true to open this link in a new tab - defaults to false
|
||||
```
|
||||
|
||||
The external links are decorated by an icon, which distinguishes them from internal links.
|
||||
You can suppress the icon by setting `hide_icon: true`.
|
||||
|
||||
By default, external links are not opened in a new tab. However, this can be enabled by:
|
||||
|
||||
1. setting `opens_in_new_tab: true` in the link's configuration object
|
||||
2. setting the configuration option `nav_external_links_new_tab: true` in `_config.yml`
|
||||
|
||||
When they conflict, `opens_in_new_tab` takes precedence.
|
||||
|
||||
---
|
||||
|
||||
## In-page navigation with Table of Contents
|
||||
|
Reference in New Issue
Block a user