Added og tags
This commit is contained in:
parent
63bd79f3c2
commit
163bfc6131
|
@ -8,6 +8,11 @@ tags:
|
|||
- Drupal
|
||||
- Drupal 7
|
||||
- Drupal Planet
|
||||
meta:
|
||||
og:
|
||||
title: 'How to Define a Minimum Drupal Core Version'
|
||||
description: 'How to define a minimum Drupal core version for your module or theme.'
|
||||
type: article
|
||||
---
|
||||
This week, my first code patch was [committed to Drupal core](https://www.drupal.org/node/2394517#comment-9773143). The patch adds the `user_has_role()` function to theu user module, to simplify the way to check whether a user in Drupal has been assigned a specific role. This is something that I normally write a custom function for each project, but it's now available in Drupal core as of [7.36](https://www.drupal.org/drupal-7.36-release-notes).
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
{% if page.meta.description %}
|
||||
<meta name="description" content="{{ page.meta.description|e('html') }}">
|
||||
{% endif %}
|
||||
{% if page.meta.og %}{% include "og" with {og: page.meta.og} %}{% endif %}
|
||||
<link rel="author" href="{{ site.url }}/humans.txt" />
|
||||
<title>{% if (page.front == true) and (site.subtitle) %}{{ site.subtitle }}{% else %}{{ page.title }}{% endif %} | {{ site.title }}</title>
|
||||
|
||||
|
|
37
source/themes/opdavies/opdavies/_partials/og.html.twig
Normal file
37
source/themes/opdavies/opdavies/_partials/og.html.twig
Normal file
|
@ -0,0 +1,37 @@
|
|||
{% if og.title %}
|
||||
<meta property="og:title" content="{{ og.title|raw }}"/>
|
||||
{% endif %}
|
||||
|
||||
{% if og.description %}
|
||||
<meta property="og:description" content="{{ og.description|raw }}"/>
|
||||
{% endif %}
|
||||
|
||||
{% if og.type %}
|
||||
<meta property="og:type" content="{{ og.type }}"/>
|
||||
{% endif %}
|
||||
|
||||
{% if og.image and og.image.url %}
|
||||
<meta property="og:image" content="{{ og.image.url }}"/>
|
||||
{% if og.image.type %}
|
||||
<meta property="og:image:type" content="{{ og.image.type }}"/>
|
||||
{% endif %}
|
||||
{% if og.image.width %}
|
||||
<meta property="og:image:width" content="{{ og.image.width }}"/>
|
||||
{% endif %}
|
||||
{% if og.image.height %}
|
||||
<meta property="og:image:height" content="{{ og.image.height }}"/>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if og.title %}
|
||||
{% if og.image %}
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:image:src" content="{{ og.image.url }}">
|
||||
<meta name="twitter:creator" content="@opdavies" />
|
||||
{% else %}
|
||||
<meta name="twitter:card" content="summary" />
|
||||
{% endif %}
|
||||
<meta name="twitter:title" content="{{ og.title|raw }}" />
|
||||
<meta name="twitter:description" content="{{ og.description|raw }}" />
|
||||
<meta name="twitter:site" content="@opdavies" />
|
||||
{% endif %}
|
Loading…
Reference in a new issue