Allowing users to rename tags globally across all pages

Hi there! I’m working on a site where I want my client to be able to categorize pages (Research, Writing, etc.) with tags, but I also want them to be able to rename these tags site-wide. For example, if they decide “Research” should be called “Archival” instead, all pages tagged with “Research” would automatically update to “Archival.”

Currently I’m using a tags field with predefined options, but this requires manually updating each page if a tag name changes.

I know I could technically just set accept: all on a tags field, but that would be less than ideal since I don’t want clients to accidentally introduce minor differences between tags (like “research” vs “Research” vs “Reasearch”). I guess another option would be using the value and text properties, where the value stays fixed but the text label is editable by the client. The front-end would display the editable text label while the content files reference the stable value. Is it possible to make the text property client-editable?

In sum, I’m looking for something with a bit more structure than a totally open field, but more flexibility than a completely fixed list. Is there a built-in approach for this, or would it require a custom plugin/panel button? Has anyone implemented something similar?

Thanks!

Exactly, that would be the way forward. As for implementing this, you could do this for example in the site.yml (maybe a separate tab) using a structure field, where users could define key-value pairs (in this case, they keys would be editable as well, though). Another option could be a blocks field with only a single block type. Users would define only the labels, while the block id would be used as value by your select/multiselect/tags field. The latter is probably the better option because of the built-in unique id.

For example, you could have a custom block like this (the icon is optional)

title: category
preview: fields
wysiwyg: true
fields:
  category:
    type: text
  icon:
    type: text

Then a block definition like this in site.yml

fields:
  type: fields
  fields:
    categories:
      type: blocks
      pretty: true
      fieldsets:
        - category

Your tags field:

tags:
  type: tags
  options:
    type: query
    query: site.categories.toBlocks
    text: "{{ item.icon }} {{ item.category.value }}"
    value: "{{ item.id }}"

Oooh I see, that’s super helpful. I didn’t know about block IDs and how those could come in handy for this scenario. Thank you!! I’ve applied that method to my project and it’s working great. :star_struck: