Improve author link flexibility
Deprecate social networking links in `_config.yml` in favor or new `author.links` array for any link and in any order. All of Font Awesome's icons are available for use.
```
author:
links:
- label: "Your Website"
icon: "fas fa-fw fa-link"
url: "https://your-site.com"
- 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"
```
Fixes #1581
This commit is contained in:
@@ -525,68 +525,36 @@ defaults:
|
||||
**Note:** To disable the author sidebar profile for a specific post or page, add `author_profile: false` to the YAML Front Matter instead.
|
||||
{: .notice--warning}
|
||||
|
||||
The theme comes pre-built with a selection of links for the most common social media networks. These are all optional and can be [assigned in `_config.yml`]({{ "/docs/configuration/" | relative_url }}).
|
||||
To assign more author links, add to the `author.links` array in [`_config.yml`]({{ "/docs/configuration/" | relative_url }}) link so. Any of [Font Awesome's icons](https://fontawesome.com/icons?d=gallery) are available for use.
|
||||
|
||||
To add more links you'll need to crack open [`_includes/author-profile-custom-links.html`](https://github.com/mmistakes/minimal-mistakes/blob/master/_includes/author-profile-custom-links.html) and add the appropriate `<li>` markup shown below.
|
||||
```yaml
|
||||
author:
|
||||
name: "Your Name"
|
||||
avatar: "/assets/images/bio-photo.jpg"
|
||||
bio: "I am an amazing person."
|
||||
location: "Somewhere"
|
||||
links:
|
||||
- label: "Made Mistakes"
|
||||
icon: "fas fa-fw fa-link"
|
||||
url: "https://mademistakes.com"
|
||||
- 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"
|
||||
```
|
||||
|
||||
**Please note:** Links added here will appear after the ones in [`_includes/author-profile.html`](https://github.com/mmistakes/minimal-mistakes/blob/master/_includes/author-profile.html). If you'd like to change the order of appearance you'll need to edit that file directly.
|
||||
**Note:** Depending on the icon and theme skin used, colors may not be used. Popular social networks like Twitter, Facebook, Instagram, Google+, etc. have the appropriate brand color set in CSS. To change or add missing colors edit [`_utilities.scss`](https://github.com/mmistakes/minimal-mistakes/blob/master/_sass/minimal-mistakes/_utilities.scss) in `<site root>/_sass/minimal-mistakes/`.
|
||||
{: .notice--info}
|
||||
|
||||
#### Social network link example
|
||||
|
||||
```html
|
||||
<li>
|
||||
<a href="https://whatever-social-network.com/username">
|
||||
<i class="fab fa-fw" aria-hidden="true"></i> Awesome Social Network
|
||||
</a>
|
||||
</li>
|
||||
```
|
||||
|
||||
To add a new link you'll need three things:
|
||||
|
||||
1. Destination URL
|
||||
2. [Font Awesome icon](https://fontawesome.com/icons?d=gallery) (`fa-` class)
|
||||
3. Label for the link
|
||||
|
||||
It's up to you if you want to wrap it in a `{% raw %}{% if %} ... {% endif %}{% endraw %}`conditional and add a variable to `_config.yml`. If you don't plan to change it then hard-coding the string is perfectly acceptable.
|
||||
|
||||
Let's run through how you'd add a new link that points to a Reddit profile. Starting with the three things from above:
|
||||
|
||||
1. `https://www.reddit.com/user/username`
|
||||
2. [`fa-reddit`](http://fontawesome.io/icon/reddit/)
|
||||
3. `Reddit`
|
||||
|
||||
And plug them into the appropriate locations:
|
||||
|
||||
```html
|
||||
<li>
|
||||
<a href="[1]">
|
||||
<i class="fab fa-fw [2]" aria-hidden="true"></i> [3]
|
||||
</a>
|
||||
</li>
|
||||
```
|
||||
|
||||
To end up with:
|
||||
|
||||
```html
|
||||
<li>
|
||||
<a href="https://www.reddit.com/user/username">
|
||||
<i class="fab fa-fw fa-reddit" aria-hidden="true"></i> Reddit
|
||||
</a>
|
||||
</li>
|
||||
```
|
||||
|
||||

|
||||
|
||||
To add a touch of color to the default black (`#000`) icon a few more steps are necessary.
|
||||
|
||||
Start by copying [`_utilities.scss`](https://github.com/mmistakes/minimal-mistakes/blob/master/_sass/minimal-mistakes/_utilities.scss) `<site root>/_sass`. Open it up to the icon section (it's near the bottom) and nest a new class beneath `.social-icons` that matches the one used to declare the Font Awesome icon. In our case `.fa-reddit`.
|
||||
|
||||
Simply add a `color` declaration and the corresponding hex code.
|
||||
For example, to color a Reddit icon, simply add a `color` declaration and the corresponding hex code like so:
|
||||
|
||||
```scss
|
||||
.social-icons {
|
||||
|
||||
.fa-reddit {
|
||||
color: #ff4500;
|
||||
}
|
||||
@@ -595,12 +563,6 @@ Simply add a `color` declaration and the corresponding hex code.
|
||||
|
||||

|
||||
|
||||
**ProTip:** For bonus points you can add it as a Sass `$variable` that you set in [`_variables.scss`](https://github.com/mmistakes/minimal-mistakes/blob/master/_sass/minimal-mistakes/_variables.scss) like the other ["brand" colors](http://brandcolors.net/). You'll need to add this file to `/_sass/` as well if you're using the Ruby Gem version of the theme.
|
||||
{: .notice--info}
|
||||
|
||||
**Please please please** don't submit [pull requests]({{ "/docs/contributing/" | relative_url }}) adding in support for "missing" social media links. I'm trying to keep things down to the minimum (hence the theme's name) and have no interest in merging such PRs :expressionless:.
|
||||
{: .notice--warning}
|
||||
|
||||
### Custom Sidebar Content
|
||||
|
||||
Blocks of content can be added by using the following under `sidebar`:
|
||||
|
||||
Reference in New Issue
Block a user