It cannot be that it was just forgotten,
This fundamental feature, thus I sought
Through thick of forum, blog, e'en post ill-gotten
Until my quest returned me to the spot
Where sat the creature with expression cursed
Inquiring why I didn't look here first.
This post is the result of a search for how to configure SEO metadata tags for content. We're all familiar with how to specify those for pages - simply go to the page in Control Panel, choose the
SEO tab and enter the
Title,
Description and
Keywords.
Well, it so happens that you can do this for content as well, but not in the same way as we do it for pages.
Let's back up a bit. WHY would we need to specify SEO for a content. Those meta tags (title, description and keywords) are relevant at a page level so search engines can determine if a given page has relevancy to a given search.
But, content, unlike pages, is just markup that is part of a whole! When we think of a content-driven website, we think of pages with each page having one (often more than one) Web Content Display portlet instances, and, don't forget, possibly one or more Asset Publisher portlet instances.
Ah! Asset Publisher, a clever device that brings back content items meeting specified criteria.
If you code your Asset Puiblisher's
Application Display Template (ADT) mindfully, it will likely have a link to a detail view of that content item. And if you've gone all the way, then you know that the detail view you see is really hosted on a placeholder page that also contains an Asset Publisher portlet instance that is configured as its
Default Asset Publisher, and that your content has its
Display Page set to the placeholder page we just talked about. All of this setup helps the Asset Publisher engine apply your content template to your content XHTML and render it on the placeholder page. These are details you are quite familiar with if you have used Asset Publisher before.
If the previous paragraph is all new to you, you are in for a treat!
Read this short blog post and come back here if you're still interested in this one.
Warning: you may not want to come back for a while because Asset Publisher might just blow you away and preoccupy you with several little project ideas.
Now, the first thing to do is go to a page that has your Asset Publisher portlet instance duly configured. Here's mine, with a fancy card view for each result.
Next, click on one of the content items so you get to the detail view of your content. This basically follows the link you coded in your ADT.
And view the page source for that selected content item. You should see something like the below.
Spot the three tags we care about - title, description and keywords and study their values.
Title: Young Night - Browse Poems - Liferay
Description: Hand in hand, we take it all in: The babble of the river, The whisper of the wind,
Keywords: free verse
Now, let's see where those values are coming from. Go into the Control Panel, then Web Content Repository, and edit the content item in question.
The title is just the
Title on the
Content tab.
Note that the
Title
specified is
Young Night
. But if you look at what got into the page source above, you can see we had:
Young Night - Browse Poems - Liferay
. The page name and site name seem to get suffixed to the Title.
Next, click on the
Abstract
tab. The
Abstract field
sources your description meta tag.
Finally, click on the
Categorization
tab. The Categories and Tags, together, source the keywords meta tag. We have one category specified,
free-verse
.
For kicks, let's add a few tags.
Now, let's go view the page source again. We should see the newly added tags show up for the
keywords meta tag. Note that the
tags and the
categories are consolidated into a comma-separated list.
So, there we have it. For content items that are served up via the Asset Publisher, we can now control the SEO
title,
description and
keywords via content metadata.
The interesting thing here is that we're making our content SEO-friendly without really thinking about it. But if an SEO specialist were to come by and ask us how they might effect changes in a specific content item's SEO tags, we now know where to point them.
Isn't life[ray] beautiful?