Demonstrate CTA.
View this pattern on the live demo site
Closing call-to-action band used at the bottom of many pages.
{% comment %}
Allows the user to define a simple CTA to be displayed on the page in its own section
Inputs:
section_class - optional classes on the outer section (defaults to vertical padding)
section_id - an optional id to apply to the section
Custom Fields:
simple_cta_heading
simple_cta_text
simple_cta_button_url
simple_cta_button_label
Outputs:
section_rendered - true when this section outputs markup, false otherwise
{% endcomment -%}
{%- var show_cta = false -%}
{%- if entity.simple_cta_heading.is_valid or entity.simple_cta_text.is_valid -%}
{%- set show_cta = true -%}
{%- elsif entity.simple_cta_button_url.is_valid and entity.simple_cta_button_label.is_valid -%}
{%- set show_cta = true -%}
{%- endif -%}
{%- if show_cta -%}
<section class="{% if section_class %}{{ section_class }}{% else %}py-4 py-lg-5{% endif %}"{% if section_id %} id="{{ section_id }}"{% endif %}>
<div class="container px-3 px-lg-4">
<div class="text-bg-dark rounded-4 p-4 p-md-5 shadow-sm">
{%- include "/partials/_simple_cta.liquid" heading:entity.simple_cta_heading text:entity.simple_cta_text button_url:entity.simple_cta_button_url button_label:entity.simple_cta_button_label cta_invert:true -%}
</div>
</div>
</section>
{%- set section_rendered = true -%}
{%- else -%}
{%- set section_rendered = false -%}
{%- endif -%}
Headline, copy, and button fields owned by this CTA.
[
{
"Type": "group",
"Fields": [
{
"Type": "text",
"FieldID": "simple_cta_heading",
"Label": "Heading"
},
{
"Type": "html",
"FieldID": "simple_cta_text",
"Label": "Text"
},
{
"Type": "url",
"FieldID": "simple_cta_button_url",
"Label": "Button URL"
},
{
"Type": "text",
"FieldID": "simple_cta_button_label",
"Label": "Button Label"
}
],
"Label": "Simple CTA"
}
]
Heading, copy, and button markup reused by the section and the blog sidebar.
{% comment %}
Renders a simple CTA with minimal styling
Inputs:
heading
text
button_url
button_label
cta_invert - when true, styles copy and button for dark section backgrounds
{% endcomment -%}
{%- var cta_invert = cta_invert | default: false -%}
<div class="position-relative text-center px-3">
{%- var title_classname = 'mb-2' -%}
{%- var subtitle_classname = 'mb-0' -%}
{%- var button_class = 'btn btn-primary' -%}
{%- if cta_invert -%}
{%- set title_classname = 'mb-2 text-white' -%}
{%- set subtitle_classname = 'mb-0 text-white opacity-75' -%}
{%- set button_class = 'btn btn-light fw-semibold text-uppercase' -%}
{%- endif -%}
{%- include '/common/_title_with_subtitle.liquid' title:heading subtitle:text title_classname:title_classname subtitle_classname:subtitle_classname -%}
{%- if button_url is_valid and button_label is_valid -%}
<p class="pt-3 mb-0"><a href="{{ button_url }}" class="{{ button_class }}">{{ button_label }}</a></p>
{%- endif -%}
</div>