This commit is contained in:
root 2021-06-18 12:46:03 +00:00
parent cdb56dc40b
commit 89b00f3210
3 changed files with 13 additions and 8 deletions

View File

@ -41,11 +41,17 @@ class CmsPage extends ComponentBase
return [];
}
public function onRun()
public function onRender()
{
$this->page["hasBlog"] = false;
if (!$this->page->page->hasComponent("SeoBlogPost")) {
if($this->page->page->hasComponent("blogPosts")){
$category = $this->page->page->components['blogPosts']->category;
$this->seo_title = $this->page["seo_title"] = $category ? $category->name : $this->page->meta_title;
$this->seo_description = $this->page["seo_description"] = $category ? $category->description : $this->page->meta_description;
$this->seo_keywords = $this->page["seo_keywords"] = $category ? $category->name :$this->page->seo_keywords;
}
else if (!$this->page->page->hasComponent("SeoBlogPost")) {
$this->seo_title = $this->page["seo_title"] = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
$this->seo_description = $this->page["seo_description"] = $this->page->meta_description;
$this->seo_keywords = $this->page["seo_keywords"] = $this->page->seo_keywords;
@ -67,10 +73,7 @@ class CmsPage extends ComponentBase
} else { //todo els if has category component
$this->hasBlog = $this->page["hasBlog"] = true;
if($this->page->page->hasComponent("blogPosts")){
$this->seo_title = $this->page["seo_title"] = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
dd($this->page->page);
}
}
}

View File

@ -11,6 +11,8 @@ robot_follow = "follow"
[viewBag]
localeTitle[en] = "Home"
localeMeta_title[en] = "All main news of Turkmenistan today. Latest news of the region."
localeMeta_description[en] = "Events. The main and latest news of politics for today. Latest political news of Turkmenistan"
[blogCategories]
slug = "{{ :slug }}"

View File

@ -2,7 +2,7 @@
[blogPosts]
pageNumber = "{{ :page }}"
postsPerPage = 6
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "published_at desc"
categoryPage = "category"