Bật Graph metatags cho Drupal content types

Bật Graph metatags cho Drupal content types

Let's do Open Graph metatags for Drupal content types with the brand new Meta tag module!

This tutorial is about creating Open Graph metatags for Recipes, but these simple steps are appicable to any Drupal content type & Open Graph type.
For this tutorial I’m assuming you've setup a basic Food Recipe content type or that you have the Recipe content type from the Recipe module with an image field.

First enable these modules (they’re included in the Meta tag module)
Meta tag API
Meta tag UI
Open Graph meta tags

Enabling Meta tag module

Then go to Home » Administration » Configuration » Search and metadata (it’s at example.com/admin/config/search/metatags)

Meta tag configuration screen

Click ‘Add a meta tag default’ (or go to /admin/config/search/metatags/config/add)
Next, select the Food Recipe content type as type. (you might have to clear cache before your Recipe content type shows up here)

Selecting Meta tag type

Click 'Add and Configure', and click ‘Open Graph’ to open it up.
Now make it look like the screenshot

Open Graph Settings in Meta tag type

So for ‘Open Graph type’ we’ll select ‘Food’ and at ‘Open Graph Image’ we’ll put the [node:field_recipe_image] token. If your recipe image field has a different name, find the token for it in the token list at the bottom of the settings page.

Save.
Now your Search and metadata list will look a bit like this.

Meta tag settings overview with Recipe type

Notice the 'Node: Cooking Recipe'.

Now test your Open Graph tags at http://developers.facebook.com/tools/debug

it will look something like this:

Open Graph debugger example

To make the 'Extraneous Property' warnings go away you could disable core's RDFa module. (ugly I know, sorry, thats the only solution I currently know).
And if you know of a neat solution to the 'og:locale' warning, please let me know, I haven't had the time to figure it out yet.
And it's giving us <meta property="og:type" content="food" />, but also says og:type is website, hope that's a Object Debugger glitch, but it could use some testing.

Update2:
To be able to apply image Styles (called imagecache presets in Drupal 6) on an image and use it as Token, have a look at this project: http://drupal.org/project/imagecache_token

The ability to imagecache_token all kinds of Entities is being built here:http://drupal.org/node/1525210

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Hướng dẫn tạo multilingual site với Panopoly

Hướng dẫn tạo multilingual site với Panopoly

Download and enable the prerequisite modules: Variable, Internationalisation, Multilingual content, Path translation, Variable translation

Giới thiệu the state of ReST API trong Headless Drupal 8

Giới thiệu the state of ReST API trong Headless Drupal 8

This allows you to use all the Drupal 8 features to edit your content but present the content not only on a Drupal frontend but also on mobile apps or anything else that can work with JSON data.

Tìm hiểu Drupal Recipe.module trong Drupal 7

Tìm hiểu Drupal Recipe.module trong Drupal 7

The Drupal Recipe module is an easy way to add the ability to put cooking recipes on your Drupal 7 site.

Công ty diệt chuột T&C

 

Diet con trung