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

 
Làm sao để trở thành một nhà khoa học dữ liệu - Data Scientist

Làm sao để trở thành một nhà khoa học dữ liệu - Data Scientist

Nhà khoa học dữ liệu (Data Scientist) được Harvard Business Review đánh giá là “công việc hấp dẫn nhất thế kỷ 21

Seo top

Quy trình SEO một trang web lên top

1. Tiếp nhận yêu cầu: khi khách  hàng liên hệ với chung tôi qua điện thoại, Email... Express Magazine sẽ xin địa chỉ web của khách hàng, và một số thông tin sau

Tính năng rất hay trong Open Atrium’s New Related Content

Tính năng rất hay trong Open Atrium’s New Related Content

In the latest 2.30 version of Open Atrium, we attempt to help both content editors and web developers

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

 

Diet con trung