Skip to content
Snippets Groups Projects
Commit c15c6b7e authored by Eloi Perdereau's avatar Eloi Perdereau
Browse files

adapt layout logic to cms fields

parent b795a8a3
No related branches found
No related tags found
1 merge request!5Big fat update, mostly cms configuration
{% if page.header.image contains "://" %}
{% capture img_path %}{{ page.header.image }}{% endcapture %}
{% if page.header.fixed_image contains "://" %}
{% capture fixed_img_path %}{{ page.header.fixed_image}}{% endcapture %}
{% else %}
{% capture img_path %}{{ page.header.image | relative_url }}{% endcapture %}
{% capture fixed_img_path %}{{ page.header.fixed_image | relative_url }}{% endcapture %}
{% endif %}
{% if page.header.cta_url contains "://" %}
......@@ -10,12 +10,10 @@
{% capture cta_path %}{{ page.header.cta_url | relative_url }}{% endcapture %}
{% endif %}
{% if page.overlay_image contains "://" %}
{% capture overlay_img_path %}{{ page.overlay_image }}{% endcapture %}
{% if page.header.overlay_image contains "://" %}
{% capture overlay_img_path %}{{ page.header.overlay_image }}{% endcapture %}
{% elsif page.overlay_image %}
{% capture overlay_img_path %}{{ page.overlay_image | relative_url }}{% endcapture %}
{% elsif author.banner %}
{% capture overlay_img_path %}{{ author.banner | relative_url }}{% endcapture %}
{% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %}
{% endif %}
{% if page.header.overlay_filter contains "rgba" %}
......@@ -24,6 +22,18 @@
{% capture overlay_filter %}rgba(0, 0, 0, {{ page.header.overlay_filter }}){% endcapture %}
{% endif %}
{% if page.header.type == 'fixed_image' %}
{% capture img_path %}{{ page.header.fixed_image }}{% endcapture %}
{% elsif page.header.type == 'overlay_image' %}
{% capture img_path %}{{ page.header.overlay_image }}{% endcapture %}
{% endif %}
{% if page.header.show_text == 'description' %}
{% capture overlay_text %}{{ page.description }}{% endcapture %}
{% elsif page.header.show_text == 'custom' %}
{% capture overlay_text %}{{ page.header.custom_text }}{% endcapture %}
{% endif %}
{% if page.header.image_description %}
{% assign image_description = page.header.image_description %}
{% else %}
......@@ -32,42 +42,40 @@
{% assign image_description = image_description | markdownify | strip_html | strip_newlines | escape_once %}
<div class="page__hero{% if page.header.overlay_color or page.overlay_image or author.banner %}--overlay{% endif %}"
style="{% if page.header.overlay_color %}background-color: {{ page.header.overlay_color | default: 'transparent' }};{% endif %} {% if overlay_img_path %}background-image: {% if overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}), {% endif %}url('{{ overlay_img_path }}');{% endif %}"
<div class="page__hero{% unless page.header.header_type == 'image-fixed' %}--overlay{% endunless %}"
style="{% if page.header.overlay_color %}background-color: {{ page.header.overlay_color | default: 'transparent' }};{% endif %} {% if page.header.type contains 'image' %}background-image: {% if overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}), {% endif %}url('{{ img_path }}');{% endif %}"
>
{% if page.overlay_image or author.banner %}
<div class="wrapper">
<h1 id="page-title" class="page__title" itemprop="headline">
{% if paginator and site.paginate_show_page_num %}
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
{% else %}
{{ page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" }}
{% endif %}
</h1>
{% if page.header.show_overlay_excerpt != false and page.excerpt %}
<p class="page__lead">{{ page.excerpt | markdownify | remove: "<p>" | remove: "</p>" }}</p>
{% endif %}
{% if page.read_time %}
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
<div class="wrapper">
{% if page.header.overlay_title %}
<h1 id="page-title" class="page__title" itemprop="headline">
{% if paginator and site.paginate_show_page_num %}
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
{% else %}
{{ page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" }}
{% endif %}
{% if page.header.cta_url %}
<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 | default: "Learn More" }}</a></p>
{% endif %}
{% if page.header.actions %}
<p>
{% for action in page.header.actions %}
{% 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 %}
</h1>
{% endif %}
{% if overlay_text %}
<p class="page__lead">{{ overlay_text | markdownify | remove: "<p>" | remove: "</p>" }}</p>
{% endif %}
{% if page.read_time %}
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
{% endif %}
{% if page.header.cta_url %}
<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 | default: "Learn More" }}</a></p>
{% endif %}
{% if page.header.actions %}
<p>
{% for action in page.header.actions %}
{% if action.url contains "://" %}
{% assign url = action.url %}
{% else %}
{% assign url = action.url | relative_url %}
{% endif %}
</div>
{% else %}
<img src="{{ img_path }}" alt="{{ image_description }}" class="page__hero-image">
<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>
{% if page.header.caption %}
<span class="page__hero-caption">{{ page.header.caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
{% endif %}
......
......@@ -6,10 +6,8 @@ layout: default
{% assign author = author[1] %}
{% assign author = site.data.authors.authors | where: "directory", author | first %}
{% if page.header.overlay_color or page.overlay_image or page.header.image or author.banner %}
{% if page.has_header %}
{% include page__hero.html %}
{% elsif page.header.video.id and page.header.video.provider %}
{% include page__hero_video.html %}
{% endif %}
{% if page.url != "/" and site.breadcrumbs %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment