Set_description

Set_description

{% set_description %}

Sets the meta description for the current page, which is output by default as part of an HTML page's {{ automatic_markup }}.

The current meta description is available at {{ automatic_markup.description }}

Examples

Using Capture to create page descriptions

Copy
{% capture page_description -%} {{ page.browser_title }} | {{ site.name }}: {% unless page.browser_title contains entity.title %} [{{ entity.title }}] {% endunless %} {{ page.meta_description | truncate: 50 '...' }} {%- endcapture %} The page description is "{{ page_description | escape }}"

Set Description

Copy
Template: {% set_description page.meta_description | prepend: ' says: "' | prepend: site.Name | append: '"' %} Or: {% if page.meta_description != "" %}{% capture pageDescription %}{{ site.name }} says: "{{ page.meta_description }}"{% endcapture %}{% set_description pageDescription %}{% endif %} Output: [site.name] says "[page.meta_description]"