Skip to content

Commit d5c80b5

Browse files
committed
Add 404 response for empty tag page
Fixes #745
1 parent 747827e commit d5c80b5

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

qa-include/pages/tag.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@
5353

5454
$qa_content = qa_content_prepare(true);
5555

56-
$qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag));
56+
if (count($questions) > 0) {
57+
$qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag));
58+
} else {
59+
$qa_content['title'] = qa_lang_html('main/no_questions_found');
60+
header('HTTP/1.0 404 Not Found');
61+
}
5762

5863
if (isset($userid) && isset($tagword)) {
5964
$favoritemap = qa_get_favorite_non_qs_map();
@@ -63,9 +68,6 @@
6368
qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword['word']));
6469
}
6570

66-
if (!count($questions))
67-
$qa_content['q_list']['title'] = qa_lang_html('main/no_questions_found');
68-
6971
$qa_content['q_list']['form'] = array(
7072
'tags' => 'method="post" action="' . qa_self_html() . '"',
7173

0 commit comments

Comments
 (0)