mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-10 14:01:22 -06:00
Fix external links for sites with no pages (#1021)
Fix #1020 - Move the display of nav external links from `_includes/nav.html` to `_layouts/default.html`. - Replace ` unless include.key` by `if site.nav_external_links`. - Wrap the body of `if site.nav_external_links` in `<ul class="nav-list">…</ul>`. To test this PR: 1. Add to `_config.yml`: ```yaml defaults: - scope: {path: ""} values: {nav_exclude: true} ``` 2. Check that the only link to appear in the nav panel is external. Co-authored-by: Matt Wang <matt@matthewwang.me>
This commit is contained in:
parent
bf6f5028af
commit
29b5d14789
@ -207,17 +207,6 @@
|
||||
</li>
|
||||
{%- endunless -%}
|
||||
{%- endfor -%}
|
||||
{%- unless include.key -%}
|
||||
{%- assign nav_external_links = site.nav_external_links -%}
|
||||
{%- for node in nav_external_links -%}
|
||||
<li class="nav-list-item external">
|
||||
<a href="{{ node.url | absolute_url }}" class="nav-list-link external">
|
||||
{{ node.title }}
|
||||
{% 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 %}
|
||||
</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
{%- endunless -%}
|
||||
</ul>
|
||||
|
||||
{%- comment -%}
|
||||
|
@ -58,6 +58,18 @@ layout: table_wrappers
|
||||
{% if pages_top_size > 0 %}
|
||||
{% include nav.html pages=site.html_pages key=nil %}
|
||||
{% endif %}
|
||||
{%- if site.nav_external_links -%}
|
||||
<ul class="nav-list">
|
||||
{%- for node in site.nav_external_links -%}
|
||||
<li class="nav-list-item external">
|
||||
<a href="{{ node.url | absolute_url }}" class="nav-list-link external">
|
||||
{{ node.title }}
|
||||
{% 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 %}
|
||||
</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{%- endif -%}
|
||||
{% if site.just_the_docs.collections %}
|
||||
{% assign collections_size = site.just_the_docs.collections | size %}
|
||||
{% for collection_entry in site.just_the_docs.collections %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user