Skip Navigation
Expand
Adding meta tags to answers
Answer ID 5668   |   Last Review Date 12/19/2018

How do I add a meta tag to answers or to a specific answer?

Environment:

Customer portal, answers, search engines, Google, show_on_pages condition page tag

Resolution:

Most of the pages in customer portal, such as /app/answers/detail do not contain the HTML head section.  Therefore it is impossible to add header meta tags directly to the detail.php file or to the answer content.

However, by using a customer portal condition page tag you can add meta tags to the head section of the template that will appear when a page is compiled.

For example adding the following code to the template will add a "nosnippet" meta tag to the answers.  The nosnippet tag changes the way results appear in Google's search results.

<rn:condition show_on_pages="/answers/detail">
<meta name="googlebot" content="nosnippet">
</rn:condition>

Unfortunately the page condition tag does not work for individual answers such as the example of adding a "no index" tag to a specific answer.  Therefore the page condition tag can be used with some PHP code. 

The following is an example for excluding answer id 12345 from search results on compliant search engines.  Note that this code is an example and a robust version designed by your developers should be used on production sites. Also the example works with in an out-of-the-box configuration and may not work with URLs that contain search terms and/or product and category URL parameters.

<rn:condition show_on_pages="answers/detail">
<?
     $x = 'a_id/12345';
     if(strstr($_SERVER['REQUEST_URI'], 'a_id/') == $x) {
          echo "<META NAME=\"ROBOTS\" CONTENT=\"NOINDEX, NOFOLLOW\">";
     }
?>
</rn:condition>

For more information on the robots meta tag please refer to http://www.robotstxt.org/meta.html.

To find the template that a page uses, open the page in a text editor and inspect the top line.

<rn:meta title="#rn:msg:SHP_TITLE_HDG#" template="standard.php" clickstream="home"/>

To access more information about the conditional page tags you can access http:<interface>.custhelp.com/ci/admin and open Page Tags either under Widgets or Framework.

You must have access to customer portal enabled to view the ci/admin page.  Refer to Answer ID 2600: Configuring WebDAV connection to access the Customer Portal.

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.