Im trying to set a config variable with the site title so that I can reuse it later a few times in the config & templates. Trouble is, it keeps running out of RAM, and i’m not sure why. bug perhaps?
I set a variable like this, at the top of the config…
'forge.sitetitle' => site()->title()->html(),
And then use it later on, in the metatags plugin for example…
I’ve run into this as well. It looks like the issue is that calling site() from the config loads the Kirby installation again, which loads the config, which calls site(), which loads the installation again, which loads the config and on and on. Because that creates a lot of PHP objects, memory is exhausted.
I have created an issue here. I can’t promise if there can be a fix (using the $site object from the config was always difficult as the object and all of its child objects depend on the config), but we will take a look at it.
Welllll I could I guess… but I use it in a few places, including stuff like the copyright line in the sites footer. It just seemed to me like a simple way to put it in one place and have it update in a dozen others from one line. I wouldnt say im doing something unreasonable
And occasionally I might want to to get clever with it, like concatenate it with a another string or something. I try to go for having to edit the least amount of code.
This thing is something I use as a base for all my sites, so I try to keep the maintenance overhead as low as possible. That way i’m just building the 20% thats particular to the current project, and not repeating effort.