Skip to content

Commit 9b6b144

Browse files
committed
Added Page N to the post lists meta titles on the second pages
1 parent 03d20af commit 9b6b144

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

Block/Archive/PostList.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ protected function _prepareLayout()
6969
}
7070
$this->pageConfig->setRobots('NOINDEX,FOLLOW');
7171

72+
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
73+
if ($pageMainTitle) {
74+
$pageMainTitle->setPageTitle(
75+
$this->escapeHtml($title)
76+
);
77+
}
78+
7279
return parent::_prepareLayout();
7380
}
7481

Block/Author/PostList.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ protected function _prepareLayout()
6464
$robots = $this->config->getAuthorRobots();
6565
$this->pageConfig->setRobots($robots);
6666
}
67+
68+
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
69+
if ($pageMainTitle) {
70+
$pageMainTitle->setPageTitle(
71+
$this->escapeHtml($author->getTitle())
72+
);
73+
}
6774
}
6875

6976
return parent::_prepareLayout();

Block/Post/PostList.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ class PostList extends \Magefan\Blog\Block\Post\PostList\AbstractList
2828
*/
2929
protected function _prepareLayout()
3030
{
31-
$page = $this->_request->getParam(
31+
$page = (int)$this->_request->getParam(
3232
\Magefan\Blog\Block\Post\PostList\Toolbar::PAGE_PARM_NAME
3333
);
3434

3535
if ($page > 1) {
3636
$this->pageConfig->setRobots('NOINDEX,FOLLOW');
37+
38+
$this->pageConfig->getTitle()->set(
39+
$this->pageConfig->getTitle()->get() . ' - ' . __('Page') . ' ' . $page
40+
);
3741
}
3842

3943
return parent::_prepareLayout();

Block/Search/PostList.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ protected function _prepareLayout()
6868
$this->pageConfig->setRobots($robots);
6969
}
7070

71+
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
72+
if ($pageMainTitle) {
73+
$pageMainTitle->setPageTitle(
74+
$this->escapeHtml($title)
75+
);
76+
}
77+
7178
return parent::_prepareLayout();
7279
}
7380

Block/Tag/PostList.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ protected function _prepareLayout()
7070
['attributes' => ['rel' => 'canonical']]
7171
);
7272
}
73+
74+
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
75+
if ($pageMainTitle) {
76+
$pageMainTitle->setPageTitle(
77+
$this->escapeHtml($tag->getTitle())
78+
);
79+
}
7380
}
7481

7582
return parent::_prepareLayout();

0 commit comments

Comments
 (0)