RSS

Newsletter

The CodeKarate Newsletter is the best way for technical ninjas to keep their swords sharpened. Don't worry, we won't flood your inbox and your email address will always remain private.
Back to Top

Drupal 7 Meta Tags module

Episode Number: 
28

In this episode we go over the Drupal 7 Meta tags module. We look at how meta tags can be easily added to the front page of your Drupal site and node pages of your Drupal website.

In this episode you will learn:

  • How to configure the Drupal 7 Meta tags module to display on the front page of your Drupal site
  • How to configure the Drupal 7 Meta tags module to display on node pages of your Drupal website
DDoD Video: 
See video
Full Text: 

Welcome to another Daily Dose of Drupal, I’m Shane and today as you can see from codekarate.com this is going to be Episode Number 28. Before we get started you can follow me on Twitter @smthomas3 or you can come over here to the codekarate.com website and sign up for the newsletter.

Today we’re going to cover the Meta Tags Module; I had someone contact me and say that they wanted to learn a little bit more about it so I’m going to go over that today and Meta Tags can be important for your search engine results and your search engine rankings.

It’s a little debatable on how much value they actually provide however it doesn’t hurt to have them so it’s a good module to at least know about. So we’ll go ahead and hop over to our test site here; I already have the Token Module installed to the latest version so I’m going to go ahead and go Drush download Meta Tag, if you want to have it downloaded the module here so I’ll come to the modules page, scroll down and find the Meta Tag section which is going to be right down here and we’re not going to cover the Open Graph Meta Tags, we’re just going to cover the basic Meta Tag Module here, so we’ll go ahead and save this and once this is saved, if you come back here there’s going to be a Permissions Page and there are also a Configuration page.

I’m not going to worry about the Permissions right now, we’re just going to go ahead and go to the Configuration Page and this allows you to do a couple of things. We’ll go ahead and we’ll look at the Global Front Page first; so we come to the front page of our website and you can see it’s just a stream of the content on the site and I’ll go ahead and I’ll open up a little developer tool over here and you’ll notice in the header tag there’s not any … there’s a Meta Tag for Drupal 7 for the Generator, there’s a content type Meta Tag but what we want to do is we want to take a look at how we can add our Meta Tags to this Front Page of the site.

So we come back here on Front Page, if you click on it it tells you that it inherits the Meta Tag from Global and uses the site name for the title which is as you can see right here it’s code karate, uses the site URL for the connectible URL which I’m guessing that it’s probably listed in here somewhere as well as the Meta Tag but we’ll go ahead and we’ll go into this override section here. Here we can give it a description and it gives you a little bit of information about how you should format that description and says usually 150 characters or less, it may be used and that’s the big key, it may be used by search engines to display information about your website. So I’ll go ahead and put a description in there, you can also put some keywords.

Now the important thing here is a lot search engines no longer support this, I think it used to be more important, now it’s not so much but it doesn’t hurt to have them I supposed so you can go ahead and add those in, you could add a title so we can do something like that if we wanted to. In the Advance Section here you have a whole bunch of different settings you can change; here for the Robots file you can prevent search engines from indexing this page, in this case you don’t want to do that, you could prevent search engine from following links and just a whole bunch of different options you can set for the Robots file, the Generator; that’s supposed to describe the name version of the software you’re using or of course using Drupal 7,you can have a copyright section, the Connecticut URL is just going to default the site URL, you can of course add a short link or publish your URL as well.

You don’t really need those, it’s kind of up to you if you want to use them, I’m going to not use them in this example but there’s also a thing down here for browsing the available tokens and this is going to launch a token browser, pop-up window and this is going to allow you to search and find different tokens that you could potentially use on your site.

So you could go ahead and grab a token here and drop this in on any of these fields, it’s just be whether that is available to use, so we’ll go ahead and save this and you can see now that you can revert it because it’s been overwritten, you can go ahead and refresh the home page, come on in here in our Fire Bug, Chrome Developer Tools I guess and you can see there’s a Meta name for Keywords; that’s Drupal and Code Karate which were the keywords where we gave it and also as the Meta Name for Description and you already saw that it has the Generator Meta Tag.

So all in all pretty easy, you can do the same thing for Nodes; so for a Node page and it’s going to go ahead and default to the Node Summary for the Description, it’s going to give you this title and of course set your Advance Options so if you had … if you didn’t want any of the Nodes on your site to be index you could go ahead and set that. You can also do this if you go into Add Content and we’ll go ahead and say we’re going to add an Article; down here there’s a Meta Tag section and you can do the same thing so you can actually override the Meta Tags.
Okay so we’ll go ahead and juts create a test article here; we could say something else for the description, you could add keywords, you can add whatever it is that is related to the post you’re creating, of course you could change the title, it’s going to default to the Node Title, a little bar and then the site name, similar to how this is set up here and of course you can go into the advance settings or browse the available tokens, go ahead and create this, you can see the title is Test Meta Tags Article, if we go ahead and open up our developer tools, come in here you’ll notice that there’s a Meta Tags for the keywords that we created, Meta Tag for the description which is different than the content of course because we set that the title is Test Meta Tags Article bar with a site name.

As you can see it’s extremely easy to drop in this module, turn it on and start creating and using Meta Tags to help annotate the HTML on your site for search engines. And that’s it for today on the Daily Dose of Drupal, as always you can follow me on Twitter @smthomas3 and if you have any ideas of things you’d like to see on the Daily Dose of Drupal, go ahead and contact me by coming to Code Karate and clicking on this contact link here or here or contact me on Twitter, until next time, have a great weekend. Thanks for watching.

Discussions

1
Fashion Belle (not verified)

Pagination for Meta Tags

An exciting new development is happening in the Meta Tags module that will allow easy implementation of page numbers in the title tags for paginated Views and taxonomy term pages. This is essential for Search Engine Optimization, and this is also the last major feature that the Page Title module has a quick UI option for that Meta Tags does not. When this is done, Meta Tags will be the module of choice, since the two modules already conflict in functionality, with Meta Tags having a more well-rounded set of features for SEO. Stay updated on the progress at this issue: http://drupal.org/node/1809652

2
drupaltutorial.co.uk (not verified)

lack of meta tag views integrate.

Hi I'm looking for an option to integrate views with the meta tag module.. any help would be greatly appreciated.

3
Damien McKenna (not verified)

Thanks, and 7.x-1.0-beta1 is out

Thanks for doing the screencast!

Just to mention it here, I released beta1 last night which is our first major milestone - it should be pretty stable & flexible, though obviously we have more improvements & fixes to do before it's worthy of a 1.0 release.

For anyone interested in using it with Views, please follow http://drupal.org/node/1151936 (hopefully will be fixed for beta2) and http://drupal.org/node/1804356.

4
atul (not verified)
5

Meta tags module with beta !

Please let me know the status of meta tags module. I see the alpha version. I think it affect the site. Thanks

6
Florance (not verified)

Implementation

Hi Shane,

Thanks for doing the screencast - love your daily dose of drupal. Your instructions have helped me implement the meta tag module...yippeee! Now, I keep loosing the meta tags for some reason, and it just shows the coding but I have to try to sort that out because I think it must be a bug.

My question is - do you know how to cut down the description automatically? At the moment there does not seem to be a way to get the description to be less than 180 characters. Just wondered if you had any ideas this can be carried out automatically. At the moment my description consists of the whole article, which I think is not good for SEO? Would love to hear your thoughts on this. Suprisingly, it is not mentioned in any of the drupal forums. Maybe I am not looking in the right place? Thanks again Shane. Florance x

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <blockquote> <img>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <css>, <html>, <php>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <python>, <ruby>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.