Skip to content

Commit 5f8ec7f

Browse files
fix: avoid unconfigured social options in sidebar (#2507)
1 parent eaf5e57 commit 5f8ec7f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

_includes/sidebar.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,21 @@
5252
{% endunless %}
5353

5454
{% for entry in site.data.contact %}
55+
{%- assign url = null -%}
56+
5557
{% case entry.type %}
5658
{% when 'github', 'twitter' %}
59+
{%- unless site[entry.type].username -%}
60+
{%- continue -%}
61+
{%- endunless -%}
5762
{%- capture url -%}
5863
https://{{ entry.type }}.com/{{ site[entry.type].username }}
5964
{%- endcapture -%}
6065
{% when 'email' %}
61-
{% assign email = site.social.email | split: '@' %}
66+
{%- unless site.social.email -%}
67+
{%- continue -%}
68+
{%- endunless -%}
69+
{%- assign email = site.social.email | split: '@' -%}
6270
{%- capture url -%}
6371
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
6472
{%- endcapture -%}

0 commit comments

Comments
 (0)