From 4794e8436f2dd0a808fc63ed30a1f6d3aabc7e1d Mon Sep 17 00:00:00 2001 From: Kohei Yoshino Date: Wed, 24 Apr 2019 15:16:27 -0400 Subject: [PATCH] Bug 1546539 - [SEO] Many legacy and printable bug pages are cached by Google --- extensions/BugModal/Extension.pm | 12 ++++++++++- .../en/default/bug_modal/edit.html.tmpl | 6 ------ qa/t/test_bug_edit.t | 13 +----------- qa/t/test_custom_fields.t | 6 ------ qa/t/test_long_list_redirection.t | 20 ------------------- template/en/default/bug/navigate.html.tmpl | 5 +---- .../default/global/site-navigation.html.tmpl | 2 -- 7 files changed, 13 insertions(+), 51 deletions(-) delete mode 100644 qa/t/test_long_list_redirection.t diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index 92240cc04..e6064424f 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -49,7 +49,17 @@ sub _alternative_show_bug_format { return '' if $ctype ne 'html'; } if (my $format = $cgi->param('format')) { - return ($format eq '__default__' || $format eq 'default') ? '' : $format; + my @ids = $cgi->param('id'); + # Drop `format=default` as well as `format=multiple`, if a single bug ID is + # provided, by redirecting to the modal UI (301 Moved Permanently) + if ($format eq '__default__' || $format eq 'default' + || ($format eq 'multiple' && scalar(@ids) == 1)) + { + $cgi->base_redirect('show_bug.cgi?id=' . $cgi->param('id'), 1); + } + # Otherwise, printable `format=multiple` is still available from bug lists + # as the Long Format option + return $format; } return $user->setting('ui_experiments') eq 'on' ? 'modal' : ''; } diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl index 3976a1085..f162ec5d9 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -1405,15 +1405,9 @@