Conditional Dynamic Documents

You can conditionally control whether a dynamic document is rendered.


If the render_static_document filter is used, the document template must not output any other content.


The render_static_document call can also be used to control whether a dynamic document is rendered. Consider case where a dynamic document should only be rendered if the policy is written in the state of California. If policy.json defines a document as follows:

  "documents": [
      "displayName": "California Regulatory Disclosure",
      "fileName": "state_specific_disclosure.pdf",
      "templateName": "state.specific.disclosure.template.liquid"

Then the render_static_document call instructs Socotra to attach the static PDF to the policy in state.specific.disclosure.template.liquid:

{% if policy_state contains "California" %}
  {% comment %} HTML of the desired dynamic document goes here: {% endcomment %}
  <h1>A heading</h1>
{% else %}
  {{ nil | render_static_document }}
{% endif %}