How to access a site field in a kirbytag

I am trying to access a field that I have setup in my site.yml as office_hours. I can’t seem to figure out how to get the contents inside the kirbytag I have created. Not sure what I am missing. Thought this would work but it doesn’t.


i feel like a little more context is needed… what field type is office_hours? what’s the kirbytag you have created? what is the expected output of the snippet you posted? where are you using it?

If the field is called office_hours, why are you trying to fetch it via

Sorry that was the other field in my site.yml - I’m trying to use a kirbytag to access any of the fields I put there so they can be used globally including in kirbytext or inside a markdown block. Long time programmer but first try at using Kirby so a lot of stumbling around right now figuring out how it all goes together. Basically creating a kirbytag called setting where I have an attribute name: so that I can request different fields.

Access the site like you did should actually work. As @bruno already suggested, could you please provide your blueprint and how exactly you are trying to access those fields inside the tag.

I have got this working now - had a variable issue. So the next question in this is is there any way to get the site field value dynamically. I have the attribute ‘name’ but I don’t know of a way to get for example site()->office_hours where my name attribute contains the value office_hours other then using a switch statement and hard coding it? Looking for something like this; site()->{$tag->name} but that doesn’t work. I’ve also noted that the kirbytags don’t render in the order they are in in my markdown block?


should work

Yes it does, great and thanks. I answered the second question myself about the order of kirbytags display. That was due my incorrect use of a snippet in the tag without the true parameter to force it to return the results instead of directly rendering the output.