Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+8 votes
in Q2A Core by
Where is the best place within the code to place meta tags?

1 Answer

0 votes
edited by
Great question! There are of course many ways to do this, but I'll tell you the one that is most likely to work with future versions of Question2Answer.

1. If you're not yet working on a custom theme, make a copy of the Default theme directory in qa-theme and name it something like MyTheme.

2. Select your custom theme in the 'Admin' panel, 'Layout' sub-panel.

3. Then, create a file in your custom theme directory called qa-theme.php, which contains the following:


    class qa_html_theme extends qa_html_theme_base
        function head_custom()

            $this->output('<META .../>');

4. Modify the <META .../> tag in the code as appropriate for your needs.

The principle here is that any theme is able to change any part of the default HTML output, by declaring a class qa_html_theme in qa-theme.php in the manner above. This class can override any method in the class qa_html_theme_base (declared in qa-include/qa-theme-base.php), and can call any base class method using qa_html_theme_base:: notation.

Beyond <META> tags, this approach can be used to modify any aspect of the markup, without worrying about compatibility with future Q2A changes.

BTW, the next beta should have a simple place in the admin interface to enter custom markup that you want inserted inside the <HEAD> part of the page, to avoid you having to customize the theme in this way.
There is now proper documentation on how to create Question2Answer themes: http://www.question2answer.org/advanced.php#theme