Properly apply relative_url filter to internal links in header overlay actions array

This commit is contained in:
Michael Rose 2018-09-11 11:42:21 -04:00
parent 90f5a98406
commit a95fae0155
4 changed files with 16 additions and 4 deletions

View file

@ -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

View file

@ -54,7 +54,12 @@
{% if page.header.actions %}
<p>
{% for action in page.header.actions %}
<a href="{{ action.url }}" class="btn btn--light-outline btn--large">{{ action.label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a>
{% if action.url contains "://" %}
{% assign url = action.url %}
{% else %}
{% assign url = action.url | relative_url %}
{% endif %}
<a href="{{ url }}" class="btn btn--light-outline btn--large">{{ action.label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a>
{% endfor %}
{% endif %}
</div>

View file

@ -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

View file

@ -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: