Skip to content

Commit 1571561

Browse files
committed
Fix for Main Page Title and Meta Title
1 parent 4af0d55 commit 1571561

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Block/Category/View.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2016 Ihor Vansach ([email protected]). All rights reserved.
3+
* Copyright © 2015-2017 Ihor Vansach ([email protected]). All rights reserved.
44
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
55
*
66
* Glory to Ukraine! Glory to the heroes!
@@ -59,6 +59,13 @@ protected function _prepareLayout()
5959
'canonical',
6060
['attributes' => ['rel' => 'canonical']]
6161
);
62+
63+
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
64+
if ($pageMainTitle) {
65+
$pageMainTitle->setPageTitle(
66+
$this->escapeHtml($category->getTitle())
67+
);
68+
}
6269
}
6370

6471
return parent::_prepareLayout();

Block/Post/View.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2016 Ihor Vansach ([email protected]). All rights reserved.
3+
* Copyright © 2015-2017 Ihor Vansach ([email protected]). All rights reserved.
44
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
55
*
66
* Glory to Ukraine! Glory to the heroes!
@@ -33,6 +33,13 @@ protected function _prepareLayout()
3333
'canonical',
3434
['attributes' => ['rel' => 'canonical']]
3535
);
36+
37+
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
38+
if ($pageMainTitle) {
39+
$pageMainTitle->setPageTitle(
40+
$this->escapeHtml($post->getTitle())
41+
);
42+
}
3643
}
3744

3845
return parent::_prepareLayout();

0 commit comments

Comments
 (0)