From a95fae01555431d6b3e0aa3e13b42f8670af02dc Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 11 Sep 2018 11:42:21 -0400 Subject: [PATCH] Properly apply `relative_url` filter to internal links in header overlay `actions` array --- CHANGELOG.md | 4 ++++ _includes/page__hero.html | 7 ++++++- docs/_docs/18-history.md | 6 +++++- test/_pages/splash-page.md | 3 +-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2c52ae3..566edf3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ - Remove deprecated `base_path` include helper. +### Bug Fixes + +- Properly apply `relative_url` filter to internal links in header overlay `actions` array. + ## [4.13.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.13.0) ### Enhancements diff --git a/_includes/page__hero.html b/_includes/page__hero.html index c67c440b..98bff72a 100644 --- a/_includes/page__hero.html +++ b/_includes/page__hero.html @@ -54,7 +54,12 @@ {% if page.header.actions %}

{% for action in page.header.actions %} - {{ action.label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }} + {% if action.url contains "://" %} + {% assign url = action.url %} + {% else %} + {% assign url = action.url | relative_url %} + {% endif %} + {{ action.label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }} {% endfor %} {% endif %} diff --git a/docs/_docs/18-history.md b/docs/_docs/18-history.md index b855a494..2714d434 100644 --- a/docs/_docs/18-history.md +++ b/docs/_docs/18-history.md @@ -4,7 +4,7 @@ permalink: /docs/history/ excerpt: "Change log of enhancements and bug fixes made to the theme." sidebar: nav: docs -last_modified_at: 2018-09-11T09:58:11-04:00 +last_modified_at: 2018-09-11T11:42:10-04:00 toc: true --- @@ -14,6 +14,10 @@ toc: true - Remove deprecated `base_path` include helper. +### Bug Fixes + +- Properly apply `relative_url` filter to internal links in header overlay `actions` array. + ## [4.13.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.13.0) ### Enhancements diff --git a/test/_pages/splash-page.md b/test/_pages/splash-page.md index b169e68a..81d56258 100644 --- a/test/_pages/splash-page.md +++ b/test/_pages/splash-page.md @@ -7,10 +7,9 @@ header: overlay_color: "#000" overlay_filter: "0.5" overlay_image: /assets/images/unsplash-image-1.jpg - cta_label: "Download" actions: - label: "Learn More" - url: "https://github.com/mmistakes/minimal-mistakes/" + url: "/terms/" caption: "Photo credit: [**Unsplash**](https://unsplash.com)" excerpt: "Bacon ipsum dolor sit amet salami ham hock ham, hamburger corned beef short ribs kielbasa biltong t-bone drumstick tri-tip tail sirloin pork chop." intro: