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
context.Items collection
| Item Key | Required | Default value | Item Value Type | Description |
|---|---|---|---|---|
| TransportPackageRootDirectory | Yes | string | The root transport package folder (typically ...\Data\Publish\Data\[RANDOMFOLDERNAME]\work\TP). | |
| ExtendedOverallPackageObjectFilePath | Yes | string | File 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
pageXHTML content file in the __packages.xml is loaded as XML in memory, parsed and the firsth1element (or the first element having aclassattribute value that starts withtitle) in thebodyelement 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.valueproperty 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 therawlanguagetitle.generated.valueproperty in the page JSON metadata file - If no h1 element is found, and no
FTITLE.logical.valueproperty is present in the page metadata, the hardcoded valueNO title foundis added to therawlanguagetitle.generated.valueproperty in the page JSON metadata file
- If an h1 element is found and it's contents is not empty, it's contents (innerxml) is added to the
- The page metadata schema file is also extended with the type of the added
rawlanguagetitle.generated.valuefield.