Commit 7f7c8e5ec7228fe2dbbb197b7ea2bcc9bd513499
1 parent
668a03b4
Seo brand
Showing
3 changed files
with
8 additions
and
6 deletions
Show diff stats
frontend/views/catalog/index.php
@@ -5,6 +5,7 @@ use app\models\Catalog; | @@ -5,6 +5,7 @@ use app\models\Catalog; | ||
5 | ?> | 5 | ?> |
6 | <?php | 6 | <?php |
7 | $this->title = $catalog->meta_title; | 7 | $this->title = $catalog->meta_title; |
8 | +$this->params['seo']['fields']['meta-title'] = $catalog->meta_title; | ||
8 | $this->registerMetaTag(['name' => 'description', 'content' => $catalog->meta_description]); | 9 | $this->registerMetaTag(['name' => 'description', 'content' => $catalog->meta_description]); |
9 | $this->registerMetaTag(['name' => 'keywords', 'content' => $catalog->meta_keywords]); | 10 | $this->registerMetaTag(['name' => 'keywords', 'content' => $catalog->meta_keywords]); |
10 | ?> | 11 | ?> |
frontend/views/catalog/products.php
@@ -10,6 +10,8 @@ use common\modules\product\helpers\ProductHelper; | @@ -10,6 +10,8 @@ use common\modules\product\helpers\ProductHelper; | ||
10 | use frontend\widgets\Seo; | 10 | use frontend\widgets\Seo; |
11 | //$this->title = $category->categoryName->value; | 11 | //$this->title = $category->categoryName->value; |
12 | $this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : ''; | 12 | $this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : ''; |
13 | + | ||
14 | +$this->params['seo']['fields']['meta-title'] = $category->meta_title; | ||
13 | $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name; | 15 | $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name; |
14 | $this->params['seo']['seo_text'] = $category->seo_text; | 16 | $this->params['seo']['seo_text'] = $category->seo_text; |
15 | $this->params['seo']['description'] = $category->meta_desc; | 17 | $this->params['seo']['description'] = $category->meta_desc; |
frontend/widgets/Seo.php
@@ -110,14 +110,10 @@ class Seo extends Widget | @@ -110,14 +110,10 @@ class Seo extends Widget | ||
110 | 110 | ||
111 | $title = $this->selectSeoData(self::TITLE); | 111 | $title = $this->selectSeoData(self::TITLE); |
112 | 112 | ||
113 | - | ||
114 | // if(!empty($filter_row)){ | 113 | // if(!empty($filter_row)){ |
115 | // return $filter_row; | 114 | // return $filter_row; |
116 | // } | 115 | // } |
117 | - if (!empty($title)) { | ||
118 | - return $title; | ||
119 | - } | ||
120 | - else if(!empty($filter)) { | 116 | + if(!empty($filter) && $title == $this->fields['meta-title']) { |
121 | 117 | ||
122 | $array = [ | 118 | $array = [ |
123 | 'category' => $this->category_name | 119 | 'category' => $this->category_name |
@@ -151,9 +147,12 @@ class Seo extends Widget | @@ -151,9 +147,12 @@ class Seo extends Widget | ||
151 | $array['year'] = $model->value->value; | 147 | $array['year'] = $model->value->value; |
152 | 148 | ||
153 | } | 149 | } |
150 | + | ||
154 | return $this->getTitleString($array); | 151 | return $this->getTitleString($array); |
155 | 152 | ||
156 | - } else { | 153 | + } else if (!empty($title)) { |
154 | + return $title; | ||
155 | + } else { | ||
157 | return $this->project_name; | 156 | return $this->project_name; |
158 | } | 157 | } |
159 | 158 |