~xdavidwu/xdavidwu.link

d2256790d8bf875223704baf2314b8c73402d3b0 — Evan Debenham 5 years ago 79f6e2f
Add logo and title customization to the masthead (#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
M CHANGELOG.md => CHANGELOG.md +1 -0
@@ 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)

M _config.yml => _config.yml +2 -0
@@ 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:

M _includes/masthead.html => _includes/masthead.html +8 -1
@@ 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 '://' -%}

M _sass/minimal-mistakes/_masthead.scss => _sass/minimal-mistakes/_masthead.scss +4 -0
@@ 39,6 39,10 @@
  }
}

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

.site-title {
  display: -webkit-box;
  display: -ms-flexbox;

M _sass/minimal-mistakes/_navigation.scss => _sass/minimal-mistakes/_navigation.scss +5 -0
@@ 189,6 189,11 @@
      color: $masthead-link-color-hover;
    }

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

    &.site-title {
      margin-left: 0;
    }