projectdoc Toolbox

Add HTML meta tags to your Confluence pages. This is for the search engine optimization (SEO) for your website as well as adding semantics for machine reading.

Audience
Level of Experience
Expected Duration
10 min
Type

One aspect of Search Engine Optimization (SEO) is to positively influence the ranking of web pages. Search engines rely partially on the meta information your web pages provide.

Meta information has a number of forms. Most important are the title of the page and the meta tags for adding semantic information.

There are standards for names of meta tags. HTML pages commonly use

There are additional meta tag names defined by other standards. One of them is Dublin Core.

The Dublin Core Schema is a small set of vocabulary terms that can be used to describe web resources (video, images, web pages, etc.), as well as physical resources such as books or CDs, and objects like artworks. 

Wikipedia

Here is an example for an HTML fragment with information derived from the document's properties:

Example Output
<link rel="profile" href="http://dublincore.org/documents/dcq-html/">
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.title" content="My Title">
<meta name="DC.description" content="My short description for the page.">
<meta name="DC.subject" content="one, two, three">

While meta tags may or may not be used by search engines for indexing, the title and descriptions are typically used to display the results. And the information is available for other consumers as well. Everyone with access to the web page has also access to the meta data.

Add Meta Information with projectdoc

It is easy to render information from a projectdoc document in meta elements. The document has its meta data already defined in the Document Properties Marker Macro and can be automatically exported for external access.

There are predefined sets of meta data that map property names to meta tag names. The generation of these tags is controlled by the space property Metadata Sets. Set this property at space level and the corresponding meta tags are automatically added for every page.

 

If you want to render HTML meta elements according to the Dublin Core standard, use the identifier DC.

Besides the meta data sets you may also select individual elements to be exported. To export a document property with a HTML meta element, authors may simply add the property control named export.

The generated HTML page for the document contains the following information in the head element:

<link rel="schema.ABC" href="http://example.com/schema/abc">
<meta name="ABC.product-version" content="1.42.73">

For more information on this topic, please refer to Export Metadata.

Integration

For integration the Confluence administrator needs to add a Velocity call to the layout.

#if ($projectdocContext)
${projectdocContext.toHtml($sitemeshPage)}
#end

Theme Add-ons

 

If a theme add-on is used, the location to add this snippet may be different.

In case the theme add-on does not allow to add such a call, the administrator has to add it to a file on the file system.

References

Export Metadata

Information on exporting metadata in this wiki.

  • export - Exports the property as metadata.
  • Export Metadata - Export document properties as metadata to the rendered HTML page.
  • export-schema - Exports the property as schema information.
  • Metadata Sets - Controls to render sets of metadata based on document properties.