Welcome to the GovCMS Content Administration Training series. Hi, I’m Ivan from Salsa Digital and in this video, you’ll learn to customise the meta tags in GovCMS.
We’ll cover the following two topics:
- What are meta tags?
- How to customise meta tags in GovCMS
What are meta tags?
Well, to answer this question, we’ll need to view the HTML source of this page. So I’ll right-click and click on “view page source”. Don’t worry about all this HTML, what I want you to focus on is this section right here.
Meta tags are used to add context, or describe a page to search engines. The text in the meta tags is not visible on the page. However, text in the “<title>” tag is displayed in the tab. Often the title and description will appear in the search engine results, so it’s important to make sure the meta tags have the correct information for search engine optimisation.
How to customise meta tags
To help with search engine optimisation, GovCMS is configured out-of-the-box to populate some meta tags. So if we take a look at the HTML:
The title tag is configured to display the page title and the site name
The canonical URL is also set
A summary of the body field is automatically added to the description meta tag
That’s the default configuration for meta tags in GovCMS, but you can customise the meta tags on individual pages. So let’s go and edit the page and you should see the “Meta tags” section on the right. If you can’t see this “Meta tags” section it means the content type doesn’t have the meta tag field. This field will need to be added by a site builder.
So if we take a look at the meta tag option you can see there’s a lot we can configure. You can see that the default configuration has the page title, description and canonical URL field pre-populated. These defaults can be changed if you have the site administrator role, and if you go to Configuration >Metatag you can configure the default from here.
Let’s go back to the edit page we were on. Make sure “Meta tags” is expanded, and then we can customise the meta tag values for just this page. I should also mention that this value with square brackets is called a token. Think of it as a placeholder that's replaced with an actual value when GovCMS (or technically Drupal) renders it. This is similar to short codes in WordPress if you’re familiar with WordPress. [node:summary] will generate a summary version of the body field. In the page title meta tag [node:title] will be replaced with the value from this title field.
Let’s go ahead and customise the page title and I’ll remove the current tokens and add “Custom standard page title”. This will only change the page title on this page. I’ll scroll down and click on Save. We can now see that the page title has changed just for this specific page. And if we view the source we can see that the title has changed.
Let’s now recap what we covered in this video. First, we discussed what meta tags are, then you learnt how to customise the meta tags for specific pages.