Global Variables
Create reusable variables for use everywhere.
Statamic parses any .yaml
files that it finds in your _config
directory and puts their contents into the list of global variables.
These variables all become tags in your templates.
So for example, you could create a globals.yaml
file, or break them up into groups with numerous .yaml
files and organize them how you’d like.
Displaying Variables
Let’s say you have a globals.yaml
file like this:
twitter_name: @statamic
support_email: help@example.com
In your templates, you can use these with appropriately-named tags:
Find us on Twitter at {{ twitter_name }}, or email us
at <a href="mailto:{{ support_email }}">{{ support_email }}</a>
Any variable you create in any of your _config
folder’s .yaml
files will become a tag available for use (even all of your site settings).