Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
915 views
in Q2A Core by
retagged by

This is a general HTML question, is there any chance to tell a bot via META tag that this is duplicate content and that the bot should only index the original question instead?

Was not able to find something in google...

Thanks :)

 

PS: I know you can use: <meta name="robots" content="noindex,follow" /> to prevent indexing this site. But is there a specific way to tell the bot that it should index the other site?
 

1 Answer

+1 vote
by
edited by

Found the answer online, we have to use: CANONICAL

However, q2a is not setting the canonical of duplicate questions to the original one.


From what I see the qa-page-question.php is setting the canonical link on line 341... with:

    // set the canonical url based on possible pagination
    $qa_content['canonical']=qa_path_html(qa_q_request($question['postid'], $question['title']),
        ($pagestart>0) ? array('start' => $pagestart) : null, qa_opt('site_url'));


So we need to check if the question is duplicate, this is how I did it (it works):

    $qa_content['canonical']=qa_path_html(qa_q_request($question['postid'], $question['title']),
        ($pagestart>0) ? array('start' => $pagestart) : null, qa_opt('site_url'));

    // added: if duplicate set canonical to original question
    if(isset($question['closedbyid'])) {
        $origQuTitleQuery = mysql_fetch_array( qa_db_query_sub('SELECT title FROM `^posts` WHERE `postid` = "'.$question['closedbyid'].'"') );
        $origQuTitle = $origQuTitleQuery[0];
        $qa_content['canonical'] = qa_path_html(qa_q_request($question['closedbyid'], $origQuTitle),
            ($pagestart>0) ? array('start' => $pagestart) : null, qa_opt('site_url'));
    }

 

Current note: I have just seen that each closed question gets also the CLOSEDBYID ... so the open question is, what is the identifier for closed-as-duplicate-questions?

Update: Now I see that the closedbyid has to be checked, if it is 'type'==NOTE then it is a normal closed question, if it is of type==Q then it is a duplicate!

@gidgreen: Could this be fixed in the next version?

Thanks, Kai
 

 

by
I've thought about it, and I don't think it makes sense to use the SEO canonical tag to map from the page for a duplicate question to the original. Even if the question is a duplicate there can still be important content on its page, that won't be index if this tag is used.
by
That's correct. My updated situation on this issue, about 6 months later: I extended NoahY's plugin 'merge posts' and added a merge button for duplicate pages. If you use it, all posts from duplicate are moved to original. Check out: https://github.com/NoahY/q2a-post-merge/pull/6

I.e. I am merging all duplicates now. Note: If the "old" URL is called the user gets redirected to the original question. That's actually the best part! (thanks to NoahY!)
...