Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setting variables from an entry within a layout
{% set metaTitle = '(entry.metaTitle) ? entry.metaTitle : entry.title' %}
{% set metaDescription = entry.metaDescription %}
{% set metaKeywords = entry.metaKeywords %}
{% set metaRobots = entry.metaRobots %}
{% set openGraphImage = entry.openGraphImage.first() %}
{% if openGraphImage %}
{% set ogCrop = {
mode: 'crop',
width: 1200,
height: 630,
quality: 75,
position: 'center'
} %}
{% set openGraphImage = openGraphImage.getUrl(ogCrop) %}
{% endif %}
{% include 'partials/_global_header.html' %}
{% block content %}
{% endblock %}
{% include 'partials/_global_footer.html' %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment