Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.8k views
in Q2A Core by
From what I understand, tags are created on a "per post basis and then indexed", but is there any way to create a bunch of default tags so that we can suggest the tags we prefer even if people haven't used them before?

Thanks
by
Interesting question! I dunno if this would work but maybe adding entries to the qa_words table with a tagcount of 1 (or higher, maybe 1000) would make them show up in the tag suggestions.

1 Answer

+3 votes
by
edited by
I've done that on my site by adding  a configuration file similar to external user called qa-external-tags.  This file picks the tag where I want. I have contribute something that does both categories and tags, but it isn't up to date with the latests Q2A so it won't work as is. You can look at in the the addon section (http://www.question2answer.org/third-party/question2answer-external-cats-tags.zip) and search for "// START OF MODIFICATIONS for external tags"in those files to get inspiration if you want to.

Basically tags are proposed at two spots: in qa-page-ask and in qa-page-question-post.  You need to add your tags to the $completetags array used in both pages. For qa-page-ask, this is rigth at the start of the file. For the other, it is in the if ($question['editbutton']) { section.
by
This is definitely a better way to go! My suggestion was merely a quick hack, and would fall down if you reindexed all the content (which happens automatically on upgrades).
by
You're right, I didn't considered re-index. Since modifications to the code are small - just a couple of lines in two files if you keep the logic to retrieve the actual tags outside q2a core -  it is easily manageable when Q2A gets a new version!
...