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

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