Feature: make contact options configurable (#58, #59).

This commit is contained in:
Cotes Chung 2020-05-23 15:54:11 +08:00
parent bcd394598b
commit 7382eaa953
2 changed files with 50 additions and 13 deletions

28
_data/contact.yml Normal file
View file

@ -0,0 +1,28 @@
# The contact options.
# v2.3
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
-
type: github
icon: 'fab fa-github-alt'
-
type: twitter
icon: 'fab fa-twitter'
-
type: email
icon: 'fas fa-envelope'
noblank: true # open link in current tab
-
type: rss
icon: 'fas fa-rss'
noblank: true
# Complete the url below to enable more contact options
-
icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
url: '' # Fill with your Linkedin homepage
-
icon: 'fab fa-stack-overflow'
url: '' # Fill with your stackoverflow homepage

View file

@ -64,18 +64,27 @@
<span class="icon-border"></span> <span class="icon-border"></span>
{% endif %} {% endif %}
<a href="https://github.com/{{ site.github.username }}" target="_blank"> {% for entry in site.data.contact %}
<i class="fab fa-github-alt"></i> {% capture url %}
</a> {%- if entry.type == 'github' -%}
<a href="https://twitter.com/{{ site.twitter.username }}" target="_blank"> https://github.com/{{ site.github.username }}
<i class="fab fa-twitter"></i> {%- elsif entry.type == 'twitter' -%}
</a> https://twitter.com/{{ site.twitter.username }}
{%- elsif entry.type == 'email' -%}
{% assign email = site.social.email | split: '@' %} {% assign email = site.social.email | split: '@' %}
<a href="javascript:window.open('mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@'))"> javascript:window.open('mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@'))
<i class="fas fa-envelope"></i> {%- elsif entry.type == 'rss' -%}
</a> {{ "/feed.xml" | relative_url }}
<a href="{{ site.baseurl }}/feed.xml" target="_blank"> {%- else -%}
<i class="fas fa-rss"></i> {{ entry.url }}
{%- endif -%}
{% endcapture %}
{% if url != '' %}
<a href="{{ url }}" {% unless entry.noblank %}target="_blank"{% endunless %}>
<i class="{{ entry.icon }}"></i>
</a> </a>
{% endif %}
{% endfor %}
</div> </div>