Edit all site-/page-wide at a single place or edit translations in the panel

A lot of CMS or Shops have all their frontend strings gathered in one place (Shopware: snippets, MODx: dictionary), which would be the translations in Kirby.

Unfortunately I can’t seem to find a way to do that in Kirby 3, without adding a single field for every single string and unnecessary bloating the panel. Ideally there would be something similar to a structure, that allows sorting and searching for specific tags and phrases. Is there a way for a client to edit translations from inside the panel?

Additionally I do have some site-wide variables I’d like to use in a page, like contact E-Mail, etc. Is there a way to use them in fields like so: “{{ site.some_field }}”?

Maybe this plugin is helpful:

I like to create a “Settings” tab on the panel’s main page that contains text fields for such values, for example a field with name email. To embed it in a template, <?= $site->email()->value() ?> is all it takes; similarly this can of course be done with more advanced fields like select or radio fields so the clients can change some settings themselves (for example we recently did that with a client who wants to display a different logo once per year – no need for me to get involved in the future, they can now switch it themselves from the panel).

That’s exactly what I am doing at the moment, but some text on the content contains site-wide informations, e.g.: “You can reach us per e-mail mail@example.com or by calling us +0123456789”.
Adding this to a field or translation would just put the value as pure text onto the frontend. Instead it would be way smarter to allow other fields values in another field, e.g.: “You can reach us per e-mail {{ site.email }} or by calling us {{ site.tel }}”.

Ah, I see what you mean!

This could maybe be hacked together using a custom Kirbytag? Writing You can reach us per e-mail (variable: email) or by calling us (variable: phone) into that settings field, creating a Kirbytag variable that renders $site->{$tag->value}()->value() and then output that original string using ->kirbytext().

Other than that, I’m not aware of any native solution; the plugin mentioned above looks like the most promising lead…

That might work! I’ve been specifically wondering if the curly braces would work “{{ site.tel }}” as they also work in the help or info parameters in blueprints.

It’s up to you if you use single or double curly braces.

2 Likes

Oh my, there it is! :smiley: