mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added name attribute to social links and improved defaults
This commit is contained in:
parent
1b72c9f17d
commit
db7c28b20e
@ -614,6 +614,10 @@ extra:
|
|||||||
link: https://linkedin.com/in/squidfunk
|
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
|
[21]: #icons
|
||||||
|
|
||||||
### Adding a Web App Manifest
|
### Adding a Web App Manifest
|
||||||
|
@ -4,9 +4,12 @@
|
|||||||
{% if config.extra.social %}
|
{% if config.extra.social %}
|
||||||
<div class="md-footer-social">
|
<div class="md-footer-social">
|
||||||
{% for social in config.extra.social %}
|
{% for social in config.extra.social %}
|
||||||
{% set _,rest = social.link.split("//") %}
|
{% set title = social.name %}
|
||||||
{% set domain = rest.split("/")[0] %}
|
{% if not title and "//" in social.link %}
|
||||||
<a href="{{ social.link }}" target="_blank" rel="noopener" title="{{ domain }}" class="md-footer-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" %}
|
{% include ".icons/" ~ social.icon ~ ".svg" %}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -24,12 +24,15 @@
|
|||||||
{% if config.extra.social %}
|
{% if config.extra.social %}
|
||||||
<div class="md-footer-social">
|
<div class="md-footer-social">
|
||||||
{% for social in config.extra.social %}
|
{% for social in config.extra.social %}
|
||||||
{% set _,rest = social.link.split("//") %}
|
{% set title = social.name %}
|
||||||
{% set domain = rest.split("/")[0] %}
|
{% if not title and "//" in social.link %}
|
||||||
|
{% set _,url = social.link.split("//") %}
|
||||||
|
{% set title = url.split("/")[0] %}
|
||||||
|
{% endif %}
|
||||||
<a
|
<a
|
||||||
href="{{ social.link }}"
|
href="{{ social.link }}"
|
||||||
target="_blank" rel="noopener"
|
target="_blank" rel="noopener"
|
||||||
title="{{ domain }}"
|
title="{{ title }}"
|
||||||
class="md-footer-social__link"
|
class="md-footer-social__link"
|
||||||
>
|
>
|
||||||
{% include ".icons/" ~ social.icon ~ ".svg" %}
|
{% include ".icons/" ~ social.icon ~ ".svg" %}
|
||||||
|
Loading…
Reference in New Issue
Block a user