From: Kohei Yoshino Date: Wed, 24 Apr 2019 19:16:27 +0000 (-0400) Subject: Bug 1546539 - [SEO] Many legacy and printable bug pages are cached by Google X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4794e8436f2dd0a808fc63ed30a1f6d3aabc7e1d;p=thirdparty%2Fbugzilla.git Bug 1546539 - [SEO] Many legacy and printable bug pages are cached by Google --- 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 @@