~xdavidwu/xdavidwu.link

84e85c0f14c761e25316853ecc6b5b656d745941 — Michael Rose 8 years ago e2f06fb
Improve URL handling for internally and externally linked pages
2 files changed, 15 insertions(+), 2 deletions(-)

M _includes/feature_row
M _includes/page__hero.html
M _includes/feature_row => _includes/feature_row +8 -1
@@ 9,6 9,13 @@
<div class="feature__wrapper">

  {% for f in feature_row %}

    {% if f.url contains "http" %}
      {% capture f_url %}{{ f.url }}{% endcapture %}
    {% else %}
      {% capture f_url %}{{ f.url | prepend: base_path }}{% endcapture %}
    {% endif %}

    <div class="feature__item{% if include.type %}--{{ include.type }}{% endif %}">
      <div class="archive__item">
        {% if f.image_path %}


@@ 35,7 42,7 @@
          {% endif %}

          {% if f.url %}
            <p><a href="{{ f.url }}" class="btn {{ f.btn_class }}">{{ f.btn_label | default: site.data.ui-text[site.locale].more_label }}</a></p>
            <p><a href="{{ f_url }}" class="btn {{ f.btn_class }}">{{ f.btn_label | default: site.data.ui-text[site.locale].more_label }}</a></p>
          {% endif %}
        </div>
      </div>

M _includes/page__hero.html => _includes/page__hero.html +7 -1
@@ 4,6 4,12 @@
  {% capture img_path %}{{ page.header.image | prepend: "/images/" | prepend: base_path }}{% endcapture %}
{% endif %}

{% if page.header.cta_url contains "http" %}
  {% capture cta_path %}{{ page.header.cta_url }}{% endcapture %}
{% else %}
  {% capture cta_path %}{{ page.header.cta_url | prepend: base_path }}{% endcapture %}
{% endif %}

{% if page.header.overlay_image contains "http" %}
  {% capture overlay_img_path %}{{ page.header.overlay_image }}{% endcapture %}
{% elsif page.header.overlay_image %}


@@ 29,7 35,7 @@
        <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> {% include read-time.html %}</p>
      {% endif %}
      {% if page.header.cta_url %}
        <p><a href="{{ page.header.cta_url }}" class="btn btn--light-outline btn--large">{{ page.header.cta_label | default: site.data.ui-text[site.locale].more_label }}</a></p>
        <p><a href="{{ cta_path }}" class="btn btn--light-outline btn--large">{{ page.header.cta_label | default: site.data.ui-text[site.locale].more_label }}</a></p>
      {% endif %}
    </div>
  {% else %}