Drupal 7 Meta Tags module
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
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.