Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logo and title customization to the masthead #2026

Merged
merged 6 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Enhancements

- Add logo and title customization to the masthead. [#2026](https://github.com/mmistakes/minimal-mistakes/pull/2026)
- Add support to customize `issue-term` for utterances comment provider. [#2022](https://github.com/mmistakes/minimal-mistakes/pull/2022)
- Allow custom canonical url on a page-by-page basis. [#2021](https://github.com/mmistakes/minimal-mistakes/pull/2021)
- 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)
Expand Down
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ url : # the base hostname & protocol for your site e.g. "ht
baseurl : # the subpath of your site, e.g. "/blog"
repository : # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes"
teaser : # path of fallback teaser image, e.g. "/assets/images/500x300.png"
logo : # path of logo image to display in the masthead, e.g. "/assets/images/88x88.png"
masthead_title : # overrides the website title displayed in the masthead, use " " for no title
# breadcrumbs : false # true, false (default)
words_per_minute : 200
comments:
Expand Down
9 changes: 8 additions & 1 deletion _includes/masthead.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{% if site.logo contains "://" %}
{% capture logo_path %}{{ site.logo }}{% endcapture %}
{% else %}
{% capture logo_path %}{{ site.logo | relative_url }}{% endcapture %}
{% endif %}

<div class="masthead">
<div class="masthead__inner-wrap">
<div class="masthead__menu">
<nav id="site-nav" class="greedy-nav">
<a class="site-title" href="{{ '/' | relative_url }}">{{ site.title }}</a>
{% if logo_path %}<a class="site-logo" href="{{ '/' | relative_url }}"><img src="{{ logo_path }}"></a>{% endif %}
<a class="site-title" href="{{ '/' | relative_url }}">{{ site.masthead_title | default: site.title }}</a>
<ul class="visible-links">
{%- for link in site.data.navigation.main -%}
{%- if link.url contains '://' -%}
Expand Down
4 changes: 4 additions & 0 deletions _sass/minimal-mistakes/_masthead.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
}
}

.site-logo img {
max-height: 2rem;
}

.site-title {
display: -webkit-box;
display: -ms-flexbox;
Expand Down
5 changes: 5 additions & 0 deletions _sass/minimal-mistakes/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@
color: $masthead-link-color-hover;
}

&.site-logo {
margin-left: 0;
margin-right: 0.5rem;
}

&.site-title {
margin-left: 0;
}
Expand Down
2 changes: 2 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ url : https://mmistakes.github.io # the base hostname & pro
baseurl : "/minimal-mistakes" # the subpath of your site, e.g. "/blog"
repository : "mmistakes/minimal-mistakes"
teaser : # path of fallback teaser image, e.g. "/assets/images/500x300.png"
logo : # path of logo image to display in the masthead, e.g. "/assets/images/88x88.png"
masthead_title : # overrides the website title displayed in the masthead, use " " for no title
# breadcrumbs : false # true, false (default)
words_per_minute : 200
comments:
Expand Down
23 changes: 22 additions & 1 deletion docs/_docs/05-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Configuration"
permalink: /docs/configuration/
excerpt: "Settings for configuring and customizing the theme."
last_modified_at: 2018-11-25T19:42:42-05:00
last_modified_at: 2019-01-15T08:31:44-05:00
toc: true
---

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

### Site masthead logo

To insert a logo before the site title, place a graphic in the `/assets/images/` directory and add the filename to `_config.yml`:

```yaml
logo: "/assets/images/88x88.png"
```

<figure>
<img src="{{ '/assets/images/mm-masthead-logo.png' | relative_url }}" alt="masthead with logo and custom title">
<figcaption>Example of masthead with logo and custom title.</figcaption>
</figure>

### Site masthead title

By default your site title is used in the masthead. You can override this text by adding the following to your `_config.yml`:

```yaml
masthead_title: "My Custom Title"
```

### Breadcrumb navigation (beta)

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:
Expand Down
3 changes: 2 additions & 1 deletion docs/_docs/18-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ permalink: /docs/history/
excerpt: "Change log of enhancements and bug fixes made to the theme."
sidebar:
nav: docs
last_modified_at: 2019-01-15T08:09:30-05:00
last_modified_at: 2019-01-15T08:32:58-05:00
toc: true
---

## Unreleased

### Enhancements

- Add logo and title customization to the masthead. [#2026](https://github.com/mmistakes/minimal-mistakes/pull/2026)
- Add support to customize `issue-term` for utterances comment provider. [#2022](https://github.com/mmistakes/minimal-mistakes/pull/2022)
- Allow custom canonical url on a page-by-page basis. [#2021](https://github.com/mmistakes/minimal-mistakes/pull/2021)
- 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)
Expand Down
Binary file added docs/assets/images/mm-masthead-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions test/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ url : # the base hostname & protocol for your site e.g. "ht
baseurl : "/test"
repository : # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes"
teaser : # path of fallback teaser image, e.g. "/assets/images/500x300.png"
logo : "/assets/images/apple-touch-icon.png" # path of logo image to display in the masthead, e.g. "/assets/images/88x88.png"
masthead_title : "Custom Title" # overrides the website title displayed in the masthead, use " " for no title
# breadcrumbs : false # true, false (default)
words_per_minute : 200
comments:
Expand Down
Binary file added test/assets/images/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.