IPublishPostProcessPlugin - DitaDeliveryExtendPageMetadata

Adds fields to the page metadata files. Currently, the plugin only extracts the title from the contents and adds it into the rawlanguagetitle.generated.value metadata property in the corresponding metadata file.

Plugin Input

Plugin configuration parameters: None

Input expected in the context.Items collection
Item KeyRequiredDefault valueItem Value TypeDescription
TransportPackageRootDirectoryYesstringThe root transport package folder (typically ...\Data\Publish\Data\[RANDOMFOLDERNAME]\work\TP).
ExtendedOverallPackageObjectFilePathYesstringFile path of the XML that contains an overview of all the files that need to be transported to Dynamic Delivery (typically full file path to __packages.xml).

Changes made to the file system:

The JSON page metadata files are extended with the entire contents (so including text and tcdl:If or HTML sub elements) of the body h1 element from the corresponding XHTML content files. The values found are put in rawlanguagetitle.generated.value.

Values set in the context as a result: None.

Values set in the context.Items collection as a result: None.

plugin name="ISHDITADELIVERYEXTENDPAGEMETADATA" example


<plugin name="ISHDITADELIVERYEXTENDPAGEMETADATA" handler="DitaDeliveryExtendPageMetadata">
  <description>
   	Adds fields to the page metadata files. Currently only the title is extracted from the xhtml contents of the page
   	and stored in the "rawlanguagetitle.generated.value" metadata field.
  </description>
  <initialize />
</plugindefinition>

Example of an extended page schema file


{
  "page_meta": {
    "properties": {
      "ishlogicalref.object.id": {
        "type": "integer",
        "searchable": "no"
      },
      ...
      "FTITLE.logical.value": {
        "type": "string",
        "searchable": "no"
      },
      ...
      "rawlanguagetitle.generated.value": {	
        "type": "string",				
        "searchable": "no"			
      }
    }
  }
}
     

Example of an extended page metadata file.


{
  "page_meta": {
    "properties": {
      "ishlogicalref.object.id": 164167,
      ...
      "FTITLE.logical.value": "gprs",
      ...
      "rawlanguagetitle.generated.value": "DITA <tcdl:If type=\"ish:Condition\" condition=\"(ditaversion=1.2)\" 
            xmlns:tcdl=\"http://www.sdl.com/web/DXA/Format\"><span class=\"ph\">1.2</span></tcdl:If>
            <tcdl:If type=\"ish:Condition\" condition=\"(ditaversion=1.3)\" xmlns:tcdl=\"http://www.sdl.com/web/DXA/Format\">
            <span class=\"ph\">1.3</span></tcdl:If> Test <strong class=\"ph b\">document</strong>"
    }
  }
}		
			

Plugin flow

DitaDeliveryExtendPageMetadata does the following:
  • Every page XHTML content file in the __packages.xml is loaded as XML in memory, parsed and the first h1 element (or the first element having a class attribute value that starts with title) in the body element is taken
    • If an h1 element is found and it's contents is not empty, it's contents (innerxml) is added to the rawlanguagetitle.generated.value property in the page JSON metadata file
    • If no h1 element is found or it's contents is empty, the value of the metadata property FTITLE.logical.value (if available) is copied to the rawlanguagetitle.generated.value property in the page JSON metadata file
    • If no h1 element is found, and no FTITLE.logical.value property is present in the page metadata, the hardcoded value NO title found is added to the rawlanguagetitle.generated.value property in the page JSON metadata file
  • The page metadata schema file is also extended with the type of the added rawlanguagetitle.generated.value field.