Skip to main content
Conditional content lets you build a single document template that produces different output depending on how each client answers your questionnaire. Instead of maintaining separate templates for every scenario, you mark sections of your Word document with simple logic tags — Gavel evaluates those tags at document-generation time and includes or omits the content accordingly. You can apply this logic to anything from a single word to an entire page of clauses.

Conditional phrases and sentences

A conditional phrase is any inline text — a word, a clause, or a full sentence — that you want to appear only when a certain condition is true. The tags wrap tightly around the text and sit inside the surrounding permanent paragraph.

Basic syntax

{% if VariableName %}Conditional text here.{% endif %}
The condition evaluates as true when the variable has a value (for Yes/No questions, this means “Yes”).

Syntax by question type

Show text when the answer is Yes:
{% if HasSpouse %}including the Spouse's community property interest{% endif %}
Show text when the answer is No (i.e., False):
{% if HasSpouse == False %}as sole and separate property{% endif %}

Multi-condition logic

Combine conditions with and or or to create more precise rules:
{% if MaritalStatus == "Married" and FavoriteColor == "Pink" %}
I am married and my favorite color is pink!
{% endif %}

Using else and elif

Instead of writing separate if/endif blocks for every alternative, you can chain conditions using else (for one alternative) or elif (for multiple alternatives). Two options with else:
{% if EntityType == "LLC" %}limited liability company{% else %}corporation{% endif %}
Three or more options with elif:
{% if MaritalStatus == "single" %}unmarried
{% elif MaritalStatus == "married" %}married
{% elif MaritalStatus == "divorced" %}formerly married
{% endif %}
The Word add-in inserts else and elif blocks for you through its UI. You only need to type this syntax manually if you are editing the document template directly in Word.

Conditional paragraphs

When the content you want to show or hide is an entire stand-alone paragraph — not inline text within a permanent paragraph — you must use the {%p ... %} variant. The p flag tells Gavel to remove the paragraph’s surrounding whitespace as well, so no blank lines are left behind in the final document.

Basic syntax

{%p if VariableName %}

Conditional paragraph text here.

{%p endif %}
If you use {% if %} instead of {%p if %} around a standalone paragraph, the blank line that held the tag will remain in the output. Always use {%p %} for full-paragraph conditions.

Conditional numbered paragraphs and table rows

The same {%p %} syntax works for numbered lists and table rows. Place the opening tag on its own line immediately before the item, and the closing tag on its own line immediately after:
{%p if IncludeArbitrationClause %}
Arbitration. All disputes arising under this Agreement shall be resolved by binding arbitration.
{%p endif %}
For a numbered paragraph inside a list, the surrounding numbers automatically re-sequence — Gavel removes the entire item, not just its text.

Using the Word add-in (no-code)

You do not need to type syntax manually. The Gavel Word add-in lets you insert both phrase-level and paragraph-level conditions through a point-and-click interface.
1

Open the Word add-in

Open your document in Microsoft Word and launch the Gavel add-in. Select the workflow you want to use.
2

Highlight the target text

Select the word, sentence, or paragraph you want to make conditional.
3

Choose the condition type

  • For inline text within a paragraph, click Show phrase when…
  • For a full standalone paragraph, click Show paragraph when…
4

Select the variable and value

Choose the variable name and the answer value that should trigger the content to appear.
5

Add additional conditions (optional)

Click Add Condition and repeat the previous step to build and/or multi-condition logic.
6

Insert

Click Insert. The add-in writes the correct syntax — including {%p %} for paragraph conditions — directly into your document.
The Word add-in is the recommended way to add conditions. It handles spacing, bracket style, and paragraph vs. phrase mode automatically.

Full example

The following illustrates how phrase-level and paragraph-level conditions can work together in a single clause:
This Agreement is entered into by {%p if IsMarried %}the Parties, who are married to each other,{%p endif %}
{% if EntityType == "LLC" %}a limited liability company{% elif EntityType == "Corporation" %}a corporation{% endif %}
organized under the laws of the State of {{ State }}.

{%p if IncludeNDA %}

CONFIDENTIALITY. Each Party agrees to hold in strict confidence all information disclosed
by the other Party in connection with this Agreement.

{%p endif %}
In the generated document, the NDA paragraph either appears in full or is omitted entirely — with no blank line left in its place.