Improve footer link flexibility

Deprecate hardcoded footer links in favor or new `footer.links` array for any link and in any order. All of Font Awesome's icons are available for use.

```
footer:
  links:
    - label: "Twitter"
      icon: "fab fa-fw fa-twitter-square"
      url: "https://twitter.com/username"
    - label: "GitHub"
      icon: "fab fa-fw fa-github"
      url: "https://github.com/username"
    - label: "Instagram"
      icon: "fab fa-fw fa-instagram"
      url: "https://instagram.com/username"
```
This commit is contained in:
Michael Rose 2018-09-10 15:06:50 -04:00
parent 42de7a56fc
commit 1504379168
5 changed files with 87 additions and 14 deletions

View file

@ -125,6 +125,28 @@ author:
icon: "fab fa-fw fa-instagram"
# url: "https://instagram.com/"
# Site Footer
footer:
links:
- label: "Twitter"
icon: "fab fa-fw fa-twitter-square"
# url:
- label: "Facebook"
icon: "fab fa-fw fa-facebook-square"
# url:
- label: "GitHub"
icon: "fab fa-fw fa-github"
# url:
- label: "GitLab"
icon: "fab fa-fw fa-gitlab"
# url:
- label: "Bitbucket"
icon: "fab fa-fw fa-bitbucket"
# url:
- label: "Instagram"
icon: "fab fa-fw fa-instagram"
# url:
# Reading Files
include:

View file

@ -3,21 +3,15 @@
{% if site.data.ui-text[site.locale].follow_label %}
<li><strong>{{ site.data.ui-text[site.locale].follow_label }}</strong></li>
{% endif %}
{% if site.twitter.username %}
<li><a href="https://twitter.com/{{ site.twitter.username }}"><i class="fab fa-fw fa-twitter-square" aria-hidden="true"></i> Twitter</a></li>
{% endif %}
{% if site.facebook.username %}
<li><a href="https://www.facebook.com/{{ site.facebook.username }}"><i class="fab fa-fw fa-facebook-square" aria-hidden="true"></i> Facebook</a></li>
{% endif %}
{% if site.author.github %}
<li><a href="https://github.com/{{ site.author.github }}"><i class="fab fa-fw fa-github" aria-hidden="true"></i> GitHub</a></li>
{% endif %}
{% if site.author.gitlab %}
<li><a href="https://gitlab.com/{{ site.author.gitlab }}"><i class="fab fa-fw fa-gitlab" aria-hidden="true"></i> Gitlab</a></li>
{% endif %}
{% if site.author.bitbucket %}
<li><a href="https://bitbucket.org/{{ site.author.bitbucket }}"><i class="fab fa-fw fa-bitbucket" aria-hidden="true"></i> Bitbucket</a></li>
{% if site.footer.links %}
{% for link in site.footer.links %}
{% if link.label and link.url %}
<li><a href="{{ link.url }}"><i class="{{ link.icon | default: 'fas fa-link' }}" aria-hidden="true"></i> {{ link.label }}</a></li>
{% endif %}
{% endfor %}
{% endif %}
<li><a href="{% if site.atom_feed.path %}{{ site.atom_feed.path }}{% else %}{{ '/feed.xml' | relative_url }}{% endif %}"><i class="fas fa-fw fa-rss-square" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].feed_label | default: "Feed" }}</a></li>
</ul>
</div>

View file

@ -118,6 +118,20 @@ author:
url: "https://instagram.com/mmistakes"
# Site Footer
footer:
links:
- label: "Twitter"
icon: "fab fa-fw fa-twitter-square"
url: "https://twitter.com/mmistakes"
- label: "GitHub"
icon: "fab fa-fw fa-github"
url: "https://github.com/mmistakes"
- label: "Instagram"
icon: "fab fa-fw fa-instagram"
url: "https://instagram.com/mmistakes"
# Reading Files
include:
- .htaccess

View file

@ -768,6 +768,35 @@ author:
To customize the author sidebar, read the full [layout documentation]({{ "/docs/layouts/#author-profile" | relative_url }}).
## Site Footer
Footer links can be added under the `footer.links` array.
| Name | Description |
| --- | --- |
| **label** | Link label (e.g. `"Twitter"`) |
| **icon** | [Font Awesome icon](https://fontawesome.com/icons?d=gallery) classes (e.g. `"fab fa-fw fa-twitter-square"`) |
| **url** | Link URL (e.g. `"https://twitter.com/mmistakes"`) |
```yaml
footer:
links:
- label: "Twitter"
icon: "fab fa-fw fa-twitter-square"
url: "https://twitter.com/mmistakes"
- label: "GitHub"
icon: "fab fa-fw fa-github"
url: "https://github.com/mmistakes"
- label: "Instagram"
icon: "fab fa-fw fa-instagram"
url: "https://instagram.com/mmistakes"
```
**Note:** Twitter and Facebook footer links no longer automatically pull from `site.twitter.username` and `site.facebook.username`. This behavior has been deprecated in favor of the `footer.links` array above.
{: .notice--danger}
To change "Follow:" text that precedes footer links, edit the `follow_label` key in `_data/ui-text.yml`.
## Reading Files
Nothing out of the ordinary here. `include` and `exclude` may be the only things you need to alter.

View file

@ -106,6 +106,20 @@ author:
url: "https://instagram.com/"
# Site Footer
footer:
links:
- label: "Twitter"
icon: "fab fa-fw fa-twitter-square"
url: "https://twitter.com/"
- label: "GitHub"
icon: "fab fa-fw fa-github"
url: "https://github.com/"
- label: "Instagram"
icon: "fab fa-fw fa-instagram"
url: "https://instagram.com/"
# Reading Files
include:
- .htaccess