From e323edb9c0134d4655e213a61e5f48dbbc059bb6 Mon Sep 17 00:00:00 2001 From: Jason Raveling Date: Sun, 24 Aug 2025 19:52:22 -0500 Subject: [PATCH 1/2] refactor(sidebar contact): Adds a conditional to check if a GitHub or Twitter username has been configured before displaying the icon in as a contact. Ensures a GitHub or Twitter username is configured in `_config.yml` before displaying them in the sidebar. Adds a conditional to capture/assign `url` so that it is `nil` if no username was provided. That way when the check for `url` is done for building the link, it will be skipped if no username is configured. --- _includes/sidebar.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/_includes/sidebar.html b/_includes/sidebar.html index 569585f6f24..878767c57fe 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -54,9 +54,13 @@ {% for entry in site.data.contact %} {% case entry.type %} {% when 'github', 'twitter' %} - {%- capture url -%} - https://{{ entry.type }}.com/{{ site[entry.type].username }} - {%- endcapture -%} + {% if site[entry.type].username %} + {%- capture url -%} + https://{{ entry.type }}.com/{{ site[entry.type].username }} + {%- endcapture -%} + {% else %} + {% assign url = nil %} + {% endif %} {% when 'email' %} {% assign email = site.social.email | split: '@' %} {%- capture url -%} From 0b55d8fb45553abd300e5233a75d3075fcb4f00b Mon Sep 17 00:00:00 2001 From: Jason Raveling Date: Sun, 24 Aug 2025 19:52:22 -0500 Subject: [PATCH 2/2] refactor(sidebar): Adds condition for GitHub/Twitter username when displaying the icon as a contact. Ensures a GitHub or Twitter username is configured in `_config.yml` before displaying them in the sidebar. Adds a conditional to capture/assign `url` so that it is `nil` if no username was provided. That way when the check for `url` is done for building the link, it will be skipped if no username is configured. --- _includes/sidebar.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/_includes/sidebar.html b/_includes/sidebar.html index 569585f6f24..878767c57fe 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -54,9 +54,13 @@ {% for entry in site.data.contact %} {% case entry.type %} {% when 'github', 'twitter' %} - {%- capture url -%} - https://{{ entry.type }}.com/{{ site[entry.type].username }} - {%- endcapture -%} + {% if site[entry.type].username %} + {%- capture url -%} + https://{{ entry.type }}.com/{{ site[entry.type].username }} + {%- endcapture -%} + {% else %} + {% assign url = nil %} + {% endif %} {% when 'email' %} {% assign email = site.social.email | split: '@' %} {%- capture url -%}