Writing Metadata

Release 1.02 - ...

The Search Engine Optimization Toolkit supports writing of Dublin Core metadata to various types of content. The 15 elements of the Dublin Core Metadata Element Set are mapped to tags of the various metadata formats.

The list of the Dublin Core Metadata Element Set:

  1. contributor
  2. coverage
  3. creator
  4. date
  5. description
  6. format
  7. identifier
  8. language
  9. publisher
  10. relation
  11. rights
  12. source
  13. subject
  14. title
  15. type

Note: At this moment the SEO toolkit only supports writing elements from the Dublin Core set as listed above. Other metadata elements can be read from, but not written to images and PDF documents. In HTML one can write additional metadata elements.

Write metadata

In SXML, metadata can be written using either the se:metadata module or using the vipers of the Smartsite Pipeline-Integrated Command Executor (Spice). When the default result format is used, se:metadata renders HTML META tags for (X)HTML pages. After rendering the se:metadata module uses Spice to forward the Dublin Core metadata to Dublin Core consumers such as the image processor and PDF generator.

The actual writing of metadata into various image types and pdf documents is done in so-called metadata commands which are implemented in the image processsor and PDF generator.

See the documentation on Smartsite Pipeline-Integrated Command Executor for more information on the concepts and architecture.

Writing metadata to images

The se:metadata macro is used for writing Dublin Core metadata to both HTML and images. A suitable location for the metadata macro is the render template. Since the metadata macro is a placeholder macro, the Dublin Core elements can be modified using extension vipers. By default the metadata macro renders HTML META tags.

The following code snippet demonstrates an incorrect render template for rendering images with metadata.

Smartsite SXML CopyCode image Copy Code
<se:region xmlns:se="http://smartsite.nl/namespaces/sxml/1.0">
  <se:metadata />
  <se:binary field="binarydata" />
</se:region>

The above snippet results in the following error:

"The result of macro 'binary' is of type 'ListOfAny' and cannot be appended to the result of the parent macro 'region' which is of the type 'Any'."

The SXML processor tries to concatenate the metadata result (the HTML META tags) with binary data.

There are two solutions; either suppress the metadata output or use the se:binary in streaming mode.

Solution 1: Suppress metadata output

Smartsite SXML CopyCode image Copy Code
<se:region xmlns:se="http://smartsite.nl/namespaces/sxml/1.0">
  <se:metadata resulttype="none" />
  <se:binary field="binarydata" />
</se:region>

When the se:binary macro is executed in streaming mode, the entire SXML processing is cancelled and the se:binary macro renders the binary output. This automatically suppresses any other output and the se:metadata resulttype doesn't need to be set to none.

Solution 2: Module se:binary in streaming mode

Smartsite SXML CopyCode image Copy Code
<se:region xmlns:se="http://smartsite.nl/namespaces/sxml/1.0">
  <se:metadata />
  <se:binary field="binarydata" streaming="true" />
</se:region>

Topics