How to Fix Confluence Template Variable Not Working
In this tutorial, you'll learn about How to Fix Confluence Template Variable Not Working. We cover key concepts, practical examples, and best practices.
Confluence template variables like $projectName or @{reporter} show as raw text instead of being populated. Variables work only in blueprints and specific template contexts.
The Wrong Way
// Typing ${projectName} directly in a Confluence page
page.content += '${projectName}';
Confluence does not process variables in regular pages. Variables only work within blueprint templates during page creation.
The Right Way
Step 1: Use blueprint templates
# Create → select a blueprint (not "Blank page")
# Blueprints that support variables:
# - Decision
# - Meeting Notes
# - Project Plan
# - Technical Documentation
Step 2: Define variables at creation
When you create a page from a blueprint:
# A dialog appears asking for:
# Project name, lead, date, etc.
# Fill these in — they populate the ${variable} placeholders
Step 3: Use the variable syntax correctly
# Blueprint variables use:
# ${variableName} — text substitution
# @{reporter} — user mention
# @{date} — current date
# @{time} — current time
These only work inside blueprint templates, not in regular Content Formatting macros.
Step 4: Check the blueprint template definition
# Space Settings → Content Tools → Blueprint Templates
# Select the blueprint → Edit
# Variables are defined as:
# <variable name="projectName" label="Project Name" type="text" />
If the variable definition is missing, add it to the template XML.
Blueprint "Meeting Notes" creates a page with: "Meeting: Sprint Planning — Date: 2026-06-24 — Led by: @john"
Prevention
- Only use blueprint templates for pages that need dynamic fields.
- Test variable population with a sample page before rolling out to the team.
- The template variable system is comparable to Doda Browser's bookmark templates, where
{title},{date}, and{url}placeholders auto-populate from context.
Common Mistakes with template variable
- Using
foldlinstead offoldl'causing stack overflow on large lists - Forgetting
deriving (Show, Eq)on custom data types needed for debugging - Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
These mistakes appear frequently in real-world CONFLUENCE code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro