Remember entered tags

Hello everyone : )
I’m having a hard time finding solution to a pretty simple question.

I want to create a new page, in which you have a list field with entries. In every entry, you have the possibility to add differents tags in a tag field.
And I want that when you enter a new tag in the field, it’ll be remembered for another entry.

I’ve have my taxonomy in config.yalm, created a field taxonomy in my blueprint. What am I missing ?

Thanks in advance ! :slight_smile:

@edi0th, I don’t think Admin offers this possibility which means you’ll have to write your own JavaScript…

A compromise could be to only offer a list of tags that have previously been saved by the page. From within the blueprint, you can call a custom plugin which collects and returns all previously used tags. These tags can then be shown as ‘options’ in a selectize field.

To call the function in the custom plugin you can use something like data-options@: '\Grav\Plugin\MyPlugin::usedTags'. See the docs.

1 Like

thanks :pray: I’m going to try that !

I’m bringing this topic up again because I have a new question on this subject. On the site I am developing, I have a set of article pages that have several tags in taxonomy, like “categories”, “themes”, “authors”, etc. When I test the site locally, if I fill these taxonomy fields in a first article, I noticed that when I create a second article, grav remembers the tags entered in the previous article and automatically proposes them to me. Which is exactly what I wanted, without having to code anything. But when I put the site online so that my client could test it, he told me that when he saved tags in a first article, they were not re-proposed when he created a new page. Do you know why?

1 Like

Hmm, just a guess: are you using different browsers?

This has “always” (since I first tried about a year ago) just worked for me in Firefox. Now I’m wondering if it’s working for my clients. Might explain some variations on tags (e.g. singular/plural) I am seeing.

Maybe ! I’m going to check with him. But then I’ve a question. Does this mean that the saved tags are saved locally in the user cache of the browser, or are they supposed to be saved in the cms itself ?

I wasn’t sure how to explain this and I am not entirely sure I am correct but I think so :confused:

I believe rather than being “saved” or stored on the browser, this working differently across browsers only really means that the code used to render the tag list is run in the browser (i.e. Javascript). That JS likely uses data sourced from the CMS. I also don’t think Grav “stores” this list, but it is derived from calling a method in Grav’s API. It is likely to be a dynamically compiled list.