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

@scott, sama55, pupi1985, I would like to remove below string from sitemap for all questions. Please let me know how to do in sitemap plugin.



also do you think this change will have any impact on search engine.

Q2A version: v1.8-github

2 Answers

+4 votes
selected by
Best answer

You haven't mentioned what Q2A version you're using but I'm assuming 1.8.

Just locate this line: https://github.com/q2a/question2answer/blob/88ba1a59c6cab3533af473731b0bbfe007a93b36/qa-plugin/xml-sitemap/qa-xml-sitemap.php#L166

And then replace:

$this->sitemap_output(qa_q_request($question['postid'], $question['title']),


$this->sitemap_output(qa_q_request($question['postid'], '']),

That will only apply the change for the Sitemap plugin.

@ pupi1985, thanks! I was looking for this one. ...for Q2A v1.8

will it have any impact for search engine. I feel it should work as long as search engine will be able to get question.
+1 vote
The function that makes the URL for questions is qa_q_request (in qa-base.php). You can make a function override that just returns the $questionid

I'm not sure exactly what you mean with regards to the sitemap but the above will change the URL everywhere including on the site itself. It wouldn't make sense to change it only for the sitemap because those URLs will just redirect to the full URLs on the site.

SEO-wise, it will be slightly worse because having keywords in the URL is a ranking factor, though it may be only a small one.
@scott, I dont want to make changes to URL structure of site. want this change only in q2asite.com/sitemap.xml file.

Like ...



OK then pupi1985's answer is good. But I still don't understand why you would want to do this, what is the purpose? You are giving search engines the wrong URLs in the sitemap.
Just experimenting with this plugin, url without string also points to same question. Not sure it will still have any impact on SEO.