Context variables
Global context
Available in every template (layout, sections, pages).
| Variable | Type | Notes |
|---|---|---|
current_url | string | absolute URL of the request |
organization | organization | see Objects |
supporter_urls.login | string | login URL |
supporter_urls.logout | string | logout URL |
supporter_urls.dashboard | string | supporter private area |
supporter_urls.profile | string | supporter profile |
supporter_urls.donations | string | supporter donations |
supporter_urls.campaigns | string | supporter campaigns |
pages | list of pages | all published pages |
campaigns | list of campaigns | all campaigns |
menus | list of menus | |
menuitems | list of menu items | |
blogs | list of blogs | |
articles | list of articles |
The global lists (campaigns, pages, blogs, articles) expose the basic
attributes of each item. The current page variable (campaign, page, blog,
article, project) exposes all the attributes described in
Objects and attributes.
Per-page variables
Each view adds its own variables to the global context.
| Page | Template | Additional variables |
|---|---|---|
| Campaign | campaign | campaign; for a Lead campaign also form, custom_field_definitions, lead_form_success |
| Thank you | thankyou | checkout_campaign, checkout_campaign_url, checkout_supporter, checkout_donation, message_published, form |
| Peer campaign | peer_campaign | campaign, peer_campaign, stats |
| Peer campaign form | peer_campaign_form | form, supporter, campaign, peer_campaign |
| Peer campaign detail | templates/supporters/peer_campaign.html | form, profile, campaign, peer_campaign, stats, peer_campaign_updated, peer_campaign_public_url, peer_campaign_manage_url |
| Page | page | page |
| Blog | blog | blog |
| Article | article | article |
| Project | project | project |
| Project list | project_list | projects |
The template used is the one for the type (e.g. campaign) or the one set on
the individual content (campaign.template).
On the thank you page checkout_supporter.id and checkout_donation.id are the
numeric ids of the supporter and of the donation just recorded: they are what
conversion pixels and dataLayers need, a stable identifier rather than the
person's name.
<script>
dataLayer.push({
event: "donation",
donation_id: "{{ checkout_donation.id }}",
supporter_id: "{{ checkout_supporter.id }}",
value: "{{ checkout_donation.amount }}",
});
</script>
In the theme preview (.../thankyou/__preview__) there is no checkout at all:
both ids are 0, like the rest of the example data.
Notes
supporterin the global context is currently alwaysNone.- SEO variables (
seo_title,seo_description,google_tag, …) live only in the header and are not accessible in theme templates. - The
donate, dashboard and supporter profile pages use separate system templates and not the sections engine.