Skip to content

Commit

Permalink
Added name attribute to social links and improved defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed May 3, 2020
1 parent 1b72c9f commit db7c28b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions material/partials/social.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
9 changes: 6 additions & 3 deletions src/partials/social.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}
Expand Down

0 comments on commit db7c28b

Please sign in to comment.