Hi all! I have a super stupid question: How can I setup a kind of a database with global texts to be used from anywhere? The simplest example: I want to save the name of my app on a table, so that I can then reference that string from anywhere within the app. Then, if I reference that string from 1000 places and I need to change the name of the app, I only have to modify it once on my table, and the 1000 places get updated.
I was doing this with “Do a search for”, in my case to add SEO descriptions and SEO titles dynamically. The problems are:
That consumes a lot of loading resources.
It does not always work (I don’t see the tags updated on the source code).
Is there a way to have a kind of “string database” full of texts that are easily loaded (without “do a search for”)? Thanks!
You’re actually doing it the right way. But you’re correct that such searches, which can only be executed after a bunch of other loading, is not fast enough for ye olde Googlebot.
@gaurav’s Environment Variables plug might be a solution (I’m not sure - haven’t tested it).
The idea is that you could load some static text not from the database (I think). At any rate, one could just build a custom plugin that makes some strings available very quickly (technically before Bubble’s page is loaded event and do this, but they wouldn’t be dynamic — which is of course ok for you.)
Hi! There is actually a built in feature for this.
You can find it in the dynamic values drop-down, it’s a thing that says “App Text (?)” this is a way for you to use text from the already built language system:
You can add a new text or use one that you already have created:
And you edit these values in the settings in the Language tab:
Oh boy, you made my day, @joao1997domingues! That worked for me! So the strings on Language make to job. My only concern is: If I use these strings for dynamic SEO-related texts, how is it going to be affected if I add new languages? What if I don’t translate those strings to languages I add? Maybe I can duplicate the same English version of the strings for the rest of the languages (so it’s always in English and there’s some consistency). Thanks a lot, really!
Your welcome!
Regarding your other question, I’m not sure what is the default when you don’t specify a text in a certain language but it’s an easy test. Also in settings you have the option to specify what field in the user tells bubble what language that user uses, you can define a field for yourself and edit that field to another language and see what happens.
In the same tab where you define your texts, you have to specify the default language of the app. So every language that aren’t defined will redirect toward the default. So no need to copy/paste into every language!
Great point, @julienallard1 and @joao1997domingues! In that case, simply leaving it blank for the rest of the new languages would be enough. You rock, guys!
Your solution works just perfect only for text.
I was asking for some global variables that can be applied anywhere on the website, for example: global discount or number of free accounts left.