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

What is the point of having this structure?

site.com/category-name and site.com/questions/category-name are obviously duplicate pages. The only difference is that /questions/category-name has pager at the bottom.

I don't understand why developers of Q2A made that. Why didn't they just put category questions on ONE single page, instead of separating them?

Anyway, we have what we have.

As a quick solution I blocked /questions urls from indexing in robots.txt.

Is there a way to put pager at the bottom of site.com/category-name and completely remove useless questions/category-name pages?

Q2A version: 1.8.3

1 Answer

+4 votes
by
edited by

... are obviously duplicate pages

Actually, there are three kind of pages related to listings for a given category. Let's use your example site and category here:

  1. site.com/category-name: It doesn't have pagination; items are sorted by creation date. If questions have answers the most recent one is chosen and its creation date is used instead of the question's creation date, a link to that answer is also included.  It doesn't show information about edits or comments. The heading for this page is "Recent questions and answers in Category Name"
  2. site.com/questions/category-name: It shows pagination when needed; If unindexed queries are allowed, items are sorted according to the parameter 'sort' in the URL (answer count, hotness, net votes, views, or creation date), otherwise items are sorted by creation date; activity in these questions (answers, comments, edits, and updates) aren't taken into account, so it only shows links to questions. The heading for this page is "Recent questions in Category Name"
  3. site.com/activity/category-name: It doesn't have pagination; items are sorted according to the last activity registered for those questions: edits, answers, comments, and so on; a link to the post (answer, question, or comment) being updated is also included. The heading for this page is "Recent activity in Category Name"

What is the point of having this structure?

To provide different levels of granularity to users: those really interested in a given category will visit site.com/activity/category-name, while those who only want to know what it is all about can visit the other links.  Q2A strives to provide a platform where developers can customize their sites on.

 Is there a way to put pager at the bottom of site.com/category-name

Yes, the first three lines of comments for qa_q_list_page_content() describe how
to add/remove pagination links. With that in mind, you can check how
qa-include/pages/questions.php provides these arguments to this function and find a way (overriding) to mimic it into qa-include/pages/default.php. They should be shown only for category pages so you'll need to add a validation for that.

completely remove useless questions/category-name pages

Yes, remove the links to them in qa-include/pages/questions.php:107 by replacing

$categorypathprefix = 'questions/';

with

$categorypathprefix = null;

And finally return a 404 page in this way:

return include QA_INCLUDE_DIR . 'qa-page-not-found.php';

when the request is about a category page.

by
Is it possible to add pager on front page as well?
by
Yes, it is. Remove the validation I mentioned above.
...