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

There is duplicate content and it is a problem for SEO.

 

site.com/categoryname and site.com/questions/categoryname have the same content.

site.com/categoryname and site.com/unanswered/categoryname have the same content too.

 

¿How can i redirect all that url with 301 to only  site.com/categoryname ?

Or how can i add canonical tag if i want that the principal url is site.com/categoryname

 

Sorry for my bad english, i speak spanish and used GTraslate.

Q2A version: 1.6.2

1 Answer

+2 votes
by

You can implement the head_custom abstract method and add cononical tag defs to the required pages. Here is some sample code:

In your theme's qa-theme.php file, add the following inside the qa_html_theme class definition:

function head_custom() {
  qa_html_theme_base::head_custom();
  if ($this->template == "unanswered" || $this->template == "questions") {
    $this->output('<link rel="canonical" href="'.qa_opt('site_url').$this->template.'"/>');
  }
}
...