We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

A question regarding globals

Kenny Horna September 7, 2020 by Kenny Horna

Hi there! This is my first time ever using Statamic (v3) so it's likely I'm making a rookie mistake here..

According to the docs, each global set is defined in a yaml file inside content/globals. I have one like so:

# content/globals/global.yaml
title: Global
  name: kennyhorna.com
  locale: es_ES

Now this variables (name/locale) should be avaliable across all of the site. The thing is that I want to use Blade instead of Antlers cause I feel more comfortable with it. So when I do something like this in my blade file:

# layout.blade.php
<title>{{ $title ?? $global->name }}</title>

It throws an error cause $global isn't defined. But If I use Antlers instead it shows the value:

# layout.antlers.html
<title>{{ title ?? global:name  }}</title>

How to make this global variables work with Blade?

Thanks in advance ;)

>>>>>>> Unanswered <<<<<<<
3 Replies