Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.1k views
in Themes by
edited by

I'm using Dude theme, and I want to echo in the head section the tags and categories for the current question page.

Something like this:

        <meta name="description" content=" categories ">
        <meta name="keywords" content=" tags ">


How can I do this ?

Q2A version: 1.6.2

1 Answer

+2 votes
by
selected by
 
Best answer

q2a automatically adds meta tags when on question page, but if you want to show category as meta descripton on other page then you can use this.

Open head.php and insert below code inside <head>

<?php $current_cat = ra_get_cat_desc(qa_request(2)); ?>

<?php if(is_array($current_cat)): ?>
   <meta name="description" content="<?php echo substr($current_cat['content'], 0, 25); ?>">
   <meta name="keywords" content="<?php echo $current_cat['title']; ?>">
<?php endif; ?>

...