Added name attribute to social links and improved defaults

This commit is contained in:
squidfunk 2020-05-03 14:14:59 +02:00
parent 1b72c9f17d
commit db7c28b20e
3 changed files with 16 additions and 6 deletions

View File

@ -614,6 +614,10 @@ extra:
link: https://linkedin.com/in/squidfunk
```
By default, the link `title` will be set to the domain name, e.g. _github.com_.
If you want to set a discernable name, e.g., to improve your Lighthouse score,
you can set the `name` attribute on each social link.
[21]: #icons
### Adding a Web App Manifest

View File

@ -4,9 +4,12 @@
{% if config.extra.social %}
<div class="md-footer-social">
{% for social in config.extra.social %}
{% set _,rest = social.link.split("//") %}
{% set domain = rest.split("/")[0] %}
<a href="{{ social.link }}" target="_blank" rel="noopener" title="{{ domain }}" class="md-footer-social__link">
{% set title = social.name %}
{% if not title and "//" in social.link %}
{% set _,url = social.link.split("//") %}
{% set title = url.split("/")[0] %}
{% endif %}
<a href="{{ social.link }}" target="_blank" rel="noopener" title="{{ title }}" class="md-footer-social__link">
{% include ".icons/" ~ social.icon ~ ".svg" %}
</a>
{% endfor %}

View File

@ -24,12 +24,15 @@
{% if config.extra.social %}
<div class="md-footer-social">
{% for social in config.extra.social %}
{% set _,rest = social.link.split("//") %}
{% set domain = rest.split("/")[0] %}
{% set title = social.name %}
{% if not title and "//" in social.link %}
{% set _,url = social.link.split("//") %}
{% set title = url.split("/")[0] %}
{% endif %}
<a
href="{{ social.link }}"
target="_blank" rel="noopener"
title="{{ domain }}"
title="{{ title }}"
class="md-footer-social__link"
>
{% include ".icons/" ~ social.icon ~ ".svg" %}