|
64 | 64 | {% endunless %} |
65 | 65 |
|
66 | 66 | {% for entry in site.data.contact %} |
67 | | - {% capture url %} |
68 | | - {%- if entry.type == 'github' -%} |
69 | | - https://github.com/{{ site.github.username }} |
70 | | - {%- elsif entry.type == 'twitter' -%} |
71 | | - https://twitter.com/{{ site.twitter.username }} |
72 | | - {%- elsif entry.type == 'email' -%} |
| 67 | + {% case entry.type %} |
| 68 | + {% when 'github', 'twitter' %} |
| 69 | + {%- capture url -%} |
| 70 | + https://{{ entry.type }}.com/{{ site[entry.type].username }} |
| 71 | + {%- endcapture -%} |
| 72 | + {% when 'email' %} |
73 | 73 | {% assign email = site.social.email | split: '@' %} |
74 | | - javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@') |
75 | | - {%- elsif entry.type == 'rss' -%} |
76 | | - {{ "/feed.xml" | relative_url }} |
77 | | - {%- else -%} |
78 | | - {{ entry.url }} |
79 | | - {%- endif -%} |
80 | | - {% endcapture %} |
| 74 | + {%- capture url -%} |
| 75 | + javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@') |
| 76 | + {%- endcapture -%} |
| 77 | + {% when 'rss' %} |
| 78 | + {% assign url = '/feed.xml' | relative_url %} |
| 79 | + {% else %} |
| 80 | + {% assign url = entry.url %} |
| 81 | + {% endcase %} |
81 | 82 |
|
82 | 83 | {% if url %} |
83 | 84 | <a href="{{ url }}" aria-label="{{ entry.type }}" |
84 | | - {% assign link_types = nil %} |
| 85 | + {% assign link_types = '' %} |
| 86 | + |
85 | 87 | {% unless entry.noblank %} |
86 | | - {% assign link_types = link_types | append: " noopener" %} |
87 | 88 | target="_blank" |
| 89 | + {% assign link_types = 'noopener noreferrer' %} |
88 | 90 | {% endunless %} |
89 | 91 |
|
90 | 92 | {% if entry.type == 'mastodon' %} |
91 | | - {% assign link_types = link_types | append: " me" %} |
| 93 | + {% assign link_types = link_types | append: ' me' | strip %} |
92 | 94 | {% endif %} |
93 | 95 |
|
94 | | - {% if link_types %}rel="{{ link_types | lstrip }}"{% endif %}> |
| 96 | + {% unless link_types == empty %}rel="{{ link_types }}"{% endunless %}> |
| 97 | + |
95 | 98 | <i class="{{ entry.icon }}"></i> |
96 | 99 | </a> |
97 | 100 | {% endif %} |
|
0 commit comments