File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
app/code/Magento/Catalog/Block
dev/tests/integration/testsuite/Magento/Catalog/Controller/Product Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ protected function _prepareLayout()
76
76
if ($ this ->_categoryHelper ->canUseCanonicalTag ()) {
77
77
$ this ->pageConfig ->addRemotePageAsset (
78
78
$ category ->getUrl (),
79
+ 'canonical ' ,
79
80
['attributes ' => ['rel ' => 'canonical ' ]]
80
81
);
81
82
}
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ protected function _prepareLayout()
148
148
if ($ this ->_productHelper ->canUseCanonicalTag ()) {
149
149
$ this ->pageConfig ->addRemotePageAsset (
150
150
$ product ->getUrlModel ()->getUrl ($ product , ['_ignore_category ' => true ]),
151
+ 'canonical ' ,
151
152
['attributes ' => ['rel ' => 'canonical ' ]]
152
153
);
153
154
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2015 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Catalog \Controller \Product ;
7
+
8
+ /**
9
+ * @magentoDataFixture Magento/Catalog/controllers/_files/products.php
10
+ */
11
+ class ViewTest extends \Magento \TestFramework \TestCase \AbstractController
12
+ {
13
+ /**
14
+ * @magentoConfigFixture current_store catalog/seo/product_canonical_tag 1
15
+ */
16
+ public function testViewActionWithCanonicalTag ()
17
+ {
18
+ $ this ->dispatch ('catalog/product/view/id/1/ ' );
19
+
20
+ $ this ->assertContains (
21
+ '<link rel="canonical" href="http://localhost/index.php/catalog/product/view/_ignore_category/1/id/1/" /> ' ,
22
+ $ this ->getResponse ()->getBody ()
23
+ );
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments