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
|
||||
```
|
||||
|
||||
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
|
||||
|
@ -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 %}
|
||||
|
@ -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" %}
|
||||
|
Loading…
Reference in New Issue
Block a user