Adding page tags

How do I add tags to a page? Is there any documentation on this? It’s was easy enough to figure out that file tags have an update method that takes a string instead of an array (which is weird but whatever) but how am I supposed to know that page tags use Concrete\Core\Entity\Attribute\Value\Value\SelectValue? You would think that tags are tags and if you figured out how to use file tags then you do the same thing with page tags, but for some reason this is not the case. I only know any of this because I’m using a debugger. How do I get tags into the page tags attribute? How do I populate a SelectValue with the desired values and get that into the tags page attribute? I see no documentation on any of the core attribute types or core page attributes. It seems like the Concrete Way of learning to develop with concrete is to slog through everything with a debugger and look through source code hoping you will find an answer there because the documentation is incredibly incomplete. Then posting to this forum and waiting a few days to get the answers that as far as I can tell are available no place else. I seriously want to know how I’m supposed to figure this out. What I’m trying to do shouldn’t be that difficult. Wordpress sucks but it is extensively documented and I have no doubt this is one of the reasons for its success. I don’t think I’m stupid but I feel stupid banging my head against a wall trying to figure this stuff out.

We use the term topic instead of tags is that the issue here?

If you go into the admin to the sitemap and open a page’s attributes you will see Tags under Navigation and Indexing. If what it calls Tags are actually Topics this should be documented, and really you should update the admin and label it Topics instead of Tags. Anyways, let me know if that is what you mean by Topics.

It doesn’t appear the documentation you link to refers to page tags.

See if any of these are helpful Tags

https://documentation.concretecms.org/api/9.1.1/Concrete/Block/Tags/Controller.html

Let’s start with general idea.

Your “Tags” have nothing in common with Topics. So don’t think about them.

“Tags” is just a name for attribute, not built-in CMS functionality per se. It could be named something else, like “Favourite words” etc.
You are probably using something like “Atomik” theme, so “Tags” attribute has been automatically added during installation.
When we are talking about “Tags” of Page, I assume we are talking about that “Option List” attribute type.
Go to /dashboard/pages/attributes and you will find it.

“Tags” of image is just “Text” attribute type (not “Option List”).
/dashboard/files/attributes

Image tags are much simpler as you discovered by yourself. Just simple string that you can display/update easily.
“Option List” is full-fledged object, so there will be differences how you should handle it.

Those tags are different because of legacy reasons/simplicity, I guess…?
It doesn’t matter though, because you CAN ADD your own “Custom tags” attribute to Files using “Option List” - similar to “Tags” in “/dashboard/pages/attributes” (if you really want). Or vice-versa.

Usually you would update attributes like:

$c->setAttribute('your_attribute_handle', 'value');

but “Option List” is a little more complicated than that.
During the weekend I will prepare some real live examples how to handle common scenarios related to “Option List” aka Tags.
I assume that information is not present in docs/it’s very well hidden. I feel you pain if that’s that’s a case.

Cheers

Your doc shows how to get tags out of a page, not how to put them in.

Thanks. Hopefully somebody will take what you provide and put it into the documentation.

Actually, take a look at this Cheatsheet if you prefer more concise “info dump”.

It’s quite comprehensive and should have answers for many questions.
At least I find it excellent for finding quick answers for common tasks.

You will find info there how to display/update attribute (especially option list attribute), how to create one, how to add options programmatically etc.

So, for now, I will not repeat code. Feel free to ask questions if you don’t find solutions there.