Skip to content
Snippets Groups Projects
Unverified Commit 6d9d4135 authored by Peter Mosses's avatar Peter Mosses Committed by GitHub
Browse files

Fix duplicated external links in collections (#1001)

Fix external links and collections

The navigation should only display the external links once, after the links to pages that are not in collections.

The test for PR #876 at https://just-the-docs.github.io/just-the-docs-tests/navigation/external-links fails with v0.4.0.rc3,
and succeeds when the updated `nav.html` is added locally.

The docs need updating to clarify how the interaction between the collections feature and the external links feature is resolved.
parent e72181e0
No related branches found
No related tags found
No related merge requests found
...@@ -183,15 +183,17 @@ ...@@ -183,15 +183,17 @@
</li> </li>
{%- endunless -%} {%- endunless -%}
{%- endfor -%} {%- endfor -%}
{%- assign nav_external_links = site.nav_external_links -%} {%- unless include.key -%}
{%- for node in nav_external_links -%} {%- assign nav_external_links = site.nav_external_links -%}
<li class="nav-list-item external"> {%- for node in nav_external_links -%}
<a href="{{ node.url | absolute_url }}" class="nav-list-link external"> <li class="nav-list-item external">
{{ node.title }} <a href="{{ node.url | absolute_url }}" class="nav-list-link external">
{% unless node.hide_icon %}<svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg>{% endunless %} {{ node.title }}
</a> {% unless node.hide_icon %}<svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg>{% endunless %}
</li> </a>
{%- endfor -%} </li>
{%- endfor -%}
{%- endunless -%}
</ul> </ul>
{%- comment -%} {%- comment -%}
......
...@@ -252,10 +252,9 @@ aux_links: ...@@ -252,10 +252,9 @@ aux_links:
## External Navigation Links ## External Navigation Links
To add external links to the navigation, add them to the `nav_external_links` [configuration]({{ site.baseurl }}{% link docs/configuration.md %}) option in your site's `_config.yml` file. To add external links to the navigation, add them to the `nav_external_links` [configuration]({{ site.baseurl }}{% link docs/configuration.md %}) option in your site's `_config.yml` file.
External links will appear under all other items in the listing order. External links will appear in the navigation after the links to ordinary pages, but before any collections.
#### Example #### Example
{: .no_toc } {: .no_toc }
```yaml ```yaml
...@@ -266,6 +265,9 @@ nav_external_links: ...@@ -266,6 +265,9 @@ nav_external_links:
hide_icon: false # set to true to hide the external link icon - defaults to false hide_icon: false # set to true to hide the external link icon - 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`.
--- ---
## In-page navigation with Table of Contents ## In-page navigation with Table of Contents
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment