File tree Expand file tree Collapse file tree 5 files changed +51
-11
lines changed
view/frontend/templates/post/view Expand file tree Collapse file tree 5 files changed +51
-11
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ protected function _prepareLayout()
4848 if ($ author = $ this ->getAuthor ()) {
4949 $ this ->_addBreadcrumbs ($ author ->getTitle (), 'blog_author ' );
5050 $ this ->pageConfig ->addBodyClass ('blog-author- ' . $ author ->getIdentifier ());
51- $ this ->pageConfig ->getTitle ()->set ($ author ->getTitle ());
51+ $ this ->pageConfig ->getTitle ()->set ($ author ->getMetaTitle ());
52+ $ this ->pageConfig ->setKeywords ($ author ->getMetaKeywords ());
53+ $ this ->pageConfig ->setDescription ($ author ->getMetaDescription ());
5254
5355 if ($ this ->config ->getDisplayCanonicalTag (\Magefan \Blog \Model \Config::CANONICAL_PAGE_TYPE_AUTHOR )) {
5456 $ this ->pageConfig ->addRemotePageAsset (
Original file line number Diff line number Diff line change @@ -37,8 +37,9 @@ public function execute()
3737
3838 $ this ->_objectManager ->get (\Magento \Framework \Registry::class)->register ('current_blog_author ' , $ author );
3939
40- $ this ->_view ->loadLayout ();
41- $ this ->_view ->renderLayout ();
40+ $ resultPage = $ this ->_objectManager ->get (\Magefan \Blog \Helper \Page::class)
41+ ->prepareResultPage ($ this , $ author );
42+ return $ resultPage ;
4243 }
4344
4445 /**
Original file line number Diff line number Diff line change @@ -62,6 +62,39 @@ public function getTitle()
6262 return $ this ->getName ();
6363 }
6464
65+ /**
66+ * Retrieve meta title
67+ * @return string
68+ */
69+ public function getMetaTitle ()
70+ {
71+ $ title = $ this ->getData ('meta_title ' );
72+ if (!$ title ) {
73+ $ title = $ this ->getTitle ();
74+ }
75+
76+ return trim ($ title );
77+ }
78+
79+ /**
80+ * Retrieve meta description
81+ * @return string
82+ */
83+ public function getMetaDescription ()
84+ {
85+ $ desc = $ this ->getData ('meta_description ' );
86+ if (!$ desc ) {
87+ $ desc = $ this ->getData ('content ' );
88+ }
89+
90+ $ desc = strip_tags ($ desc );
91+ if (mb_strlen ($ desc ) > 300 ) {
92+ $ desc = mb_substr ($ desc , 0 , 300 );
93+ }
94+
95+ return trim ($ desc );
96+ }
97+
6598 /**
6699 * Retrieve author identifier
67100 * @return string | null
Original file line number Diff line number Diff line change 217217 </field >
218218 <field id =" robots" translate =" label comment" type =" select" sortOrder =" 50" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
219219 <label >Default Robots</label >
220+ <depends >
221+ <field id =" enabled" >1</field >
222+ </depends >
220223 <source_model >Magento\Config\Model\Config\Source\Design\Robots</source_model >
221224 <comment >This will be included before head closing tag in page HTML.</comment >
222225 </field >
Original file line number Diff line number Diff line change 1515?>
1616
1717<?php if ($ block ->displayPosts ()) { ?>
18- <?php $ _postCollection = $ block ->getPostCollection (); ?>
19- <?php if ($ _postCollection -> count ()) { ?>
18+ <?php $ postCollection = $ block ->getPostCollection (); ?>
19+ <?php if (count ($ postCollection )) { ?>
2020 <div class="block related">
2121 <div class="block-title title">
2222 <strong id="block-relatedposts-heading" role="heading" aria-level="2">
23- <?php echo __ ('Related Posts ' ) ?>
23+ <?= __ ('Related Posts ' ) ?>
2424 </strong>
2525 </div>
2626 <ol class="block-content">
27- <?php foreach ($ _postCollection as $ _post ) { ?>
27+ <?php foreach ($ postCollection as $ post ) { ?>
2828 <li class="item">
29- <a class="post-item-link"
30- href="<?php echo $ _post ->getPostUrl () ?> ">
31- <?php echo $ block ->escapeHtml ($ _post ->getTitle ()); ?>
29+ <a class="post-item-link" title=" <?= $ block -> escapeHtml ( $ post -> getTitle ()) ?> "
30+ href="<?= $ post ->getPostUrl () ?> ">
31+ <?= $ block ->escapeHtml ($ post ->getTitle ()) ?>
3232 </a>
3333 </li>
3434 <?php } ?>
3535 </ol>
3636 </div>
3737 <?php } ?>
38- <?php } ?>
38+ <?php } ?>
39+
You can’t perform that action at this time.
0 commit comments