Skip to content

Commit 282806a

Browse files
00-Evanmmistakes
authored andcommittedJan 15, 2019
Add logo and title customization to the masthead (mmistakes#2026)
* Add logo and title customization to the masthead * Adjust config description * Add test site logo to `/test` * Document `site.logo` and `site.masthead_title` * Update CHANGELOG and history
1 parent 86e95b4 commit 282806a

File tree

11 files changed

+48
-3
lines changed

11 files changed

+48
-3
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Enhancements
44

5+
- Add logo and title customization to the masthead. [#2026](https://github.com/mmistakes/minimal-mistakes/pull/2026)
56
- Add support to customize `issue-term` for utterances comment provider. [#2022](https://github.com/mmistakes/minimal-mistakes/pull/2022)
67
- Allow custom canonical url on a page-by-page basis. [#2021](https://github.com/mmistakes/minimal-mistakes/pull/2021)
78
- Update table of contents navigation based on scroll position to indicate which link is currently active in the viewport. [#2020](https://github.com/mmistakes/minimal-mistakes/pull/2020)

‎_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ url : # the base hostname & protocol for your site e.g. "ht
2424
baseurl : # the subpath of your site, e.g. "/blog"
2525
repository : # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes"
2626
teaser : # path of fallback teaser image, e.g. "/assets/images/500x300.png"
27+
logo : # path of logo image to display in the masthead, e.g. "/assets/images/88x88.png"
28+
masthead_title : # overrides the website title displayed in the masthead, use " " for no title
2729
# breadcrumbs : false # true, false (default)
2830
words_per_minute : 200
2931
comments:

‎_includes/masthead.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
{% if site.logo contains "://" %}
2+
{% capture logo_path %}{{ site.logo }}{% endcapture %}
3+
{% else %}
4+
{% capture logo_path %}{{ site.logo | relative_url }}{% endcapture %}
5+
{% endif %}
6+
17
<div class="masthead">
28
<div class="masthead__inner-wrap">
39
<div class="masthead__menu">
410
<nav id="site-nav" class="greedy-nav">
5-
<a class="site-title" href="{{ '/' | relative_url }}">{{ site.title }}</a>
11+
{% if logo_path %}<a class="site-logo" href="{{ '/' | relative_url }}"><img src="{{ logo_path }}"></a>{% endif %}
12+
<a class="site-title" href="{{ '/' | relative_url }}">{{ site.masthead_title | default: site.title }}</a>
613
<ul class="visible-links">
714
{%- for link in site.data.navigation.main -%}
815
{%- if link.url contains '://' -%}

‎_sass/minimal-mistakes/_masthead.scss

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
}
4040
}
4141

42+
.site-logo img {
43+
max-height: 2rem;
44+
}
45+
4246
.site-title {
4347
display: -webkit-box;
4448
display: -ms-flexbox;

‎_sass/minimal-mistakes/_navigation.scss

+5
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@
189189
color: $masthead-link-color-hover;
190190
}
191191

192+
&.site-logo {
193+
margin-left: 0;
194+
margin-right: 0.5rem;
195+
}
196+
192197
&.site-title {
193198
margin-left: 0;
194199
}

‎docs/_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ url : https://mmistakes.github.io # the base hostname & pro
1919
baseurl : "/minimal-mistakes" # the subpath of your site, e.g. "/blog"
2020
repository : "mmistakes/minimal-mistakes"
2121
teaser : # path of fallback teaser image, e.g. "/assets/images/500x300.png"
22+
logo : # path of logo image to display in the masthead, e.g. "/assets/images/88x88.png"
23+
masthead_title : # overrides the website title displayed in the masthead, use " " for no title
2224
# breadcrumbs : false # true, false (default)
2325
words_per_minute : 200
2426
comments:

‎docs/_docs/05-configuration.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Configuration"
33
permalink: /docs/configuration/
44
excerpt: "Settings for configuring and customizing the theme."
5-
last_modified_at: 2018-11-25T19:42:42-05:00
5+
last_modified_at: 2019-01-15T08:31:44-05:00
66
toc: true
77
---
88

@@ -223,6 +223,27 @@ header:
223223
<figcaption>Example of teaser images found in the related posts module.</figcaption>
224224
</figure>
225225

226+
### Site masthead logo
227+
228+
To insert a logo before the site title, place a graphic in the `/assets/images/` directory and add the filename to `_config.yml`:
229+
230+
```yaml
231+
logo: "/assets/images/88x88.png"
232+
```
233+
234+
<figure>
235+
<img src="{{ '/assets/images/mm-masthead-logo.png' | relative_url }}" alt="masthead with logo and custom title">
236+
<figcaption>Example of masthead with logo and custom title.</figcaption>
237+
</figure>
238+
239+
### Site masthead title
240+
241+
By default your site title is used in the masthead. You can override this text by adding the following to your `_config.yml`:
242+
243+
```yaml
244+
masthead_title: "My Custom Title"
245+
```
246+
226247
### Breadcrumb navigation (beta)
227248

228249
Enable breadcrumb links to help visitors better navigate deep sites. Because of the fragile method of implementing them they don't always produce accurate links reliably. For best results:

‎docs/_docs/18-history.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ permalink: /docs/history/
44
excerpt: "Change log of enhancements and bug fixes made to the theme."
55
sidebar:
66
nav: docs
7-
last_modified_at: 2019-01-15T08:09:30-05:00
7+
last_modified_at: 2019-01-15T08:32:58-05:00
88
toc: true
99
---
1010

1111
## Unreleased
1212

1313
### Enhancements
1414

15+
- Add logo and title customization to the masthead. [#2026](https://github.com/mmistakes/minimal-mistakes/pull/2026)
1516
- Add support to customize `issue-term` for utterances comment provider. [#2022](https://github.com/mmistakes/minimal-mistakes/pull/2022)
1617
- Allow custom canonical url on a page-by-page basis. [#2021](https://github.com/mmistakes/minimal-mistakes/pull/2021)
1718
- Update table of contents navigation based on scroll position to indicate which link is currently active in the viewport. [#2020](https://github.com/mmistakes/minimal-mistakes/pull/2020)
28 KB
Loading

‎test/_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ url : # the base hostname & protocol for your site e.g. "ht
1818
baseurl : "/test"
1919
repository : # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes"
2020
teaser : # path of fallback teaser image, e.g. "/assets/images/500x300.png"
21+
logo : "/assets/images/apple-touch-icon.png" # path of logo image to display in the masthead, e.g. "/assets/images/88x88.png"
22+
masthead_title : "Custom Title" # overrides the website title displayed in the masthead, use " " for no title
2123
# breadcrumbs : false # true, false (default)
2224
words_per_minute : 200
2325
comments:
1.43 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.