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

 
Movies With Butter

Giới thiệu Drupal site: Movies With Butter

I was inspired to create Movies with Butter after reading about another site's migration from Pligg to Drupal with the Drigg module two years ago. If you wanted to build a Digg-like aggregator back then, your best options were Pligg and Drigg.

Theo dõi eCommerce metrics với Google Analytics

Theo dõi eCommerce metrics với Google Analytics

Knowing how your email communication performs in terms of ROI can say a lot about whether or not your message resonates with your target audience.

Firefox

Có gì mới ở Firefox 15

Thế là sao 5 tuần thử nghiệm, Firefox 15 sẽ được chính thức giới thiệu và cho tải về tại trang chủ của Firefox. Cũng như nhiều trình duyệt khác, mổi khi phiên bản chính thức mới được phát hành thì điều luôn trang bị bên mình một số các tính năng mới, khởi động và duyệt trang nhanh hơn, bên cạnh đó là khắc phục một số lỗi phát sinh từ phiên bản trước đó.

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

 

Diet con trung