Skip to content

Instantly share code, notes, and snippets.

@telesma
Created February 1, 2016 05:58
Show Gist options
  • Save telesma/c49bf0e00d98e529e8e5 to your computer and use it in GitHub Desktop.
Save telesma/c49bf0e00d98e529e8e5 to your computer and use it in GitHub Desktop.
Craft CMS Basic Meta Information
<!-- General Page Meta -->
{% if entry.seoDescription is defined %}
{% if entry.seoDescription is not empty %}
<meta name="description" content="{{ entry.seoDescription }}">
{% endif %}
{% endif %}
{% if entry.seoKeywords is defined %}
{% if entry.seoKeywords is not empty %}
<meta name="keywords" content="{{ entry.seoKeywords }}">
{% endif %}
{% endif %}
<!-- Facebook Meta Tags -->
{% if entry.title is defined %}
<meta property="og:title" content="{{ entry.title }}">
{% endif %}
<meta property="og:site_name" content="{{ siteName }}">
<meta property="og:url" content="{{ url(craft.request.path) }}">
{% if entry.seoDescription is defined %}
{% if entry.seoDescription is not empty %}
<meta property="og:description" content="{{ entry.seoDescription }}">
{% endif %}
{% endif %}
{% if entry.seoImage is defined %}
{% if entry.seoImage is not empty %}
<meta property="og:image" content="{% for image in entry.seoImage %}{{ image.getUrl('seoSocialShareImage') }}{% endfor %}">
{% endif %}
{% endif %}
<meta property="og:type" content="website">
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
{% if entry.title is defined %}
<meta name="twitter:title" content="{{ entry.title }}">
{% endif %}
{% if entry.seoDescription is defined %}
{% if entry.seoDescription is not empty %}
<meta name="twitter:description" content="{{ entry.seoDescription }}">
{% endif %}
{% endif %}
{% if entry.seoImage is defined %}
{% if entry.seoImage is not empty %}
<meta name="twitter:image:src" content="{% for image in entry.seoImage %}{{ image.getUrl('seoSocialShareImage') }}{% endfor %}">
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment