Add HTML meta tags for Search Engine Optimization
To enhance we can add HTML title and other meta tags to the page source. These meta tags are used to define keywords and other metadata that search engines and crawlers can use when creating search indexes and collections. When including content in a page with a Web Content Viewer portlet, we can improve the SEO of the page by adding title and meta tags with values derived from the web content itself. We override default values by editing portlet preferences in the Web Content Viewers.Having multiple web content viewers on the same page set meta tag values may result in worse SEO, especially if the multiple viewers set different values for the same meta tag name. When you have multiple viewers on the same page, modify preferences for only a single viewer whose content best represents what the page is about. We can then use that viewer to define a new HTML title and any meta tags.
Override the HTML title for a page and set meta tags
We can define an HTML title that better reflects the content on the page. We can even have the viewer pull the title directly from the rendered content.
- Select one Web Content Viewer to be the primary viewer on the page.
- Go to:
Edit Shared Settings | Page Display Title
- Select a value other than Use default title.
To have the title value come directly from the web content being rendered by the viewer, select...
Select from content
- Save the changes
The page header is updated with the new title value. For example:
<head>
<title>Display title of the rendered web content</title>
</head>
Use portlet preferences to add meta tags to page header
Each meta tag is defined by a pair of portlet preferences:
- meta.tag.name.suffix
- meta.tag.content.suffix
...where suffix identifies the name of the meta tag. For example...
- meta.tag.name.keywords
To define a specific attribute for the meta tag:
meta.tag.attribute.suffix.
The suffix portion of each preference is used to associate a name preference with its related value preference. The suffix can be any value as long as it is unique across the preferences.
Add portlet preferences to a Web Content Viewer
- Manage Pages portlet
Locate the instance of the web content viewer to modify, and select...
Configure portlet
- xmlaccess.sh
Export the page containing the instance of the web content viewer to modify. Edit the exported XML file with the meta tags to add, and update the page by using the XML file along with the xmlaccess command.
To specify the portal preference for the name of the meta tag.
meta.tag.name.suffix= name
To specify an attribute other than the name attribute:
meta.tag.attribute.suffix=attribute_name
For example, to add the following meta tag with the name keywords:
<meta name="keywords" content=""""/>
...specify the following preference:
meta.tag.name.1=keywords
To add the following meta tag with the http-equiv attribute:
<meta http-equiv=”content-language” content=”en-US”/>
...specify the following preference...
meta.tag.attribute.1=http-equiv
Specify the portal preference for the value of the meta tag
The value of the meta tag can be specified in three ways:
- Explicitly enter text for the meta tag value.
- Derived from the value of a text element in the rendered web content.
- Derived from properties containing information about the rendered web content.
Depending on how to specify the meta tag value, different portlet preferences are required. Only one value can be specified per suffix.
- Use preset text
- The meta tag value takes the following format:
meta.tag.content.text.suffix=text
The suffix portion must match the suffix value of the associated meta.tag.name.suffix preference. The text portion indicates the text to use for the meta tag value.
- Use the value of an element
- The meta tag value takes the following format:
meta.tag.content.element.suffix=name_of_element
The suffix portion must match the suffix value of the associated meta.tag.name.suffix preference. The name_of_element portion indicates the name of the element from the web content being rendered.
Element Meta tag value Text component Text of the element Date component Date of the element Image component URL of the image File component URL of the file
- Use a property
- The meta tag value takes the following format:
meta.tag.content.property.suffix=property
The suffix portion must match the suffix value of the associated meta.tag.name.suffix preference. The property portion indicates the property containing information about the web content being rendered. The properties are associated with fields on the rendered content.
Property Meta tag value AdditionalViewers Name of additional viewers Authors Display names of the authors of the rendered content authtemplatename Name of the authoring template of the rendered content authtemplatetitle Display title of the authoring template of the rendered content Categories Titles of any categories associated with the rendered content CreationDate Creation date of the rendered content Creator Display name of the user who created the rendered content CurrentStage Name of the current workflow stage of the rendered content Description Localized description of the rendered content ExpiryDate Expiration date of the rendered content ID ID of the rendered content GeneralDateOne Date from the general date one field GeneralDateTwo Date from the general date two field Keywords Keywords associated with the rendered content LastModifiedDate Date that the rendered content was last modified LastModifier Display name of the user who made the last change to the rendered content Name Name of the rendered content Owners Display names of the owners of the rendered content PublishDate Date the rendered content was published SitePath Site path of the rendered content Status Workflow status of the rendered content Title Localized title of the rendered content Workflow Name of the workflow of the rendered content
Default values for common meta tags
For several of the most common meta tags, default values are predefined. For these meta tags, we can create the portlet preference for only the meta tag name. The meta tag value is provided automatically, without the need for a corresponding name preference. The following meta tags have default values:
Tag Default Author Authors of the content Keywords Keywords associated with the content Description Localized description of the content
If you do not want to use the default value, we can set the value using one of the methods previously described.
If the value of the meta tag requires a scheme attribute
If the value of the meta tag requires a scheme attribute, specify the scheme with preference...
meta.tag.scheme.suffix=attribute_value
For example specify the following preference:
meta.tag.scheme.1=W3CDTF
...to produce...
<meta name="DC.date" content="2000-01-01T12:00+00:00" scheme="W3CDTF"/>
The format and scheme used to write date elements and content properties related to date and time information, such as the LastModifiedDate property, depends on the meta tag attribute name. By default, all date and time information is formatted according to the date format defined by the HTTP specification. The format used to write date and time information in other meta tags is the data and time format recommended by the World Wide Web Consortium (W3C) under the scheme named W3CDTF.
Examples
The following examples demonstrate the different ways of specifying portlet preferences and the resulting meta tags in the output.
- Set the meta tag value with the user who created the rendered content:
meta.tag.name.1=DC.creator
meta.tag.content.property.1=CreatorResult:
<meta name=”DC.creator” content=”content admin”/>
- Set the meta tag value with preset text:
meta.tag.name.1=DC.publisher
meta.tag.content.text.1=IBMResult:
<meta name=”DC.publisher” content=”IBM”/>
- Set multiple meta tag values with the default value for the author and the value of the text element descelement in the rendered content:
meta.tag.name.1=author
meta.tag.name.2=description
meta.tag.content.element.2=descelementResult:
<meta name=”author” content=”content author”/>
<meta name=”description” content=”Information about IBM”/>
- Set the meta tag with an http-equiv attribute and a value of the date that the rendered content was last modified.
meta.tag.name.1=last-modified
meta.tag.attribute.1=http-equiv
meta.tag.content.property.1=LastModifiedDateResult:
<meta http-equiv=”last-modified” content=”Mon, 01 Aug 2011 13:45:57 GMT”/>
- Set the meta tag and with a scheme attribute and a value of the date that the rendered content was published.
meta.tag.name.1=DC.date
meta.tag.scheme.1=W3CDTF
meta.tag.content.property.1=PublishDateResult:
<meta name=”DC.date” content=”2011-08-01T08:15:30+02:00” scheme="W3CDTF"/>
Parent: Customize web content delivery