From 29b5d147896a5156d826fcb2b01799b7fc27d4f5 Mon Sep 17 00:00:00 2001 From: Peter Mosses <18308236+pdmosses@users.noreply.github.com> Date: Sat, 5 Nov 2022 08:35:37 +0100 Subject: [PATCH] Fix external links for sites with no pages (#1021) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ``. 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 --- _includes/nav.html | 11 ----------- _layouts/default.html | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/_includes/nav.html b/_includes/nav.html index 305ac71..994a4b2 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -207,17 +207,6 @@ {%- endunless -%} {%- endfor -%} -{%- unless include.key -%} - {%- assign nav_external_links = site.nav_external_links -%} - {%- for node in nav_external_links -%} - - {%- endfor -%} -{%- endunless -%} {%- comment -%} diff --git a/_layouts/default.html b/_layouts/default.html index 6e95317..f80f52d 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -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 -%} + + {%- 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 %}