This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

will51511
will51511

This is my first time of using October CMS, all has gone well apart from an issue with calling data from an external yaml file. I have a details.yaml file in theme/data from which I would like to display data which is common throughout all pages, is this possible? The details.yaml is this format:-

company: 'xxxxx'
building: 'xxxx'
address: 'xxxxx'
road: 'xxx'
village: 'xxxx'
city: 'xxxx'
county: 'xxxx'
postcode: 'xxxxxx'
country: 'United Kingdom'
displayphone: '01234 567890'
phone: '01234567890'

I have then tried calling for the data like this:-

<li>
<a href="tel:{{ 'data/details.yml.phone' }}" aria-label="{{ 'data/details.yml.company' }} Phone Number">{{ 'data/details.yml.displayphone' }}</a>
</li>

This does not work, is this possible? If not is there an alternative way to acheive this?

Last updated

will51511
will51511

Newbie mistake, I have realised that adding the data to the theme.yaml with a form and then using the twig format below works a treat:-

 <li>
<a href="tel:{{ this.theme.phone }}" aria-label="{{ this.theme.company }} Phone Number">{{ this.theme.displayphone }}</a>
</li>
Flynsarmy
Flynsarmy

Good stuff!

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.