Create Custom Rules for Schema Publishing
Create custom rules for schema while publishing to improve accuracy of schema deployed
In some cases the content on the screen does not match schema properties that need to be tagged. Applying a custom schema rule to map certain pieces of page content to schema can greatly reduce tagging and deployment times.
Milestone Schema Manager lets you create custom rules for schema on a page so that you do not need to individually tag and map pieces of page content to schema properties.
Milestone Schema Manager > Tag/View > Tag Schema > Edit
Step 1: Click on ‘Tag Schema’ in the ‘Tag/View’ option in the left navigation panel of Milestone Schema. Manager.
Step 2: Click on the edit icon in the right column corresponding to the schema you wish to apply the custom rule.
Step 3: From the schema manager toolbar to the right click on the ‘+’ corresponding to the schema you wish to add the custom rule to.
Step 4: In the schema property click on the three-dot menu corresponding to the element you wish to add the custom rule to and go to ‘Advanced Configuration’.
In this case the days of the week at displayed as ‘Mon’, ‘Tue’, ‘Wed’, etc., on the page but schema vocabulary uses ‘Monday’, Tuesday’, ‘Wednesday’, etc.
Step 5: From the ‘Advanced Configuration’ menu we can validate the x-path for the element.
In the case the x-path returns the value ‘Mon’, we wish for it to return ‘Monday’
Step 6: To add a custom rule for this x-path click on ‘Add Fiter’ and select ‘Custom Script’ from the dropdown menu.
Step 7: Click on the script section to view and edit the script. JavaScript (JS) is used for creating custom rules for schema deployment.
Step 8: To the top of the ‘Custom Script’ section you can see the Input value.
Step 9: Add the custom JS below this and click on ‘Execute’. You can input custom functions into the script box here.
Step 10: The output will be displayed below.
Step 11: Click on ‘Ok’ to apply the custom script.
Step 12: Click on ‘Save’ to apply the custom rule to the schema.
Once you have applied the custom rule the properties will automatically update in the Schema Manager live tagging section.
If the input field is empty the custom script will display an error.