Commit af359dbb525a3a098e631be47c03a486167fc811

Authored by Alexey Boroda
1 parent a6a11086

-Seo sort and pagination fix

Showing 1 changed file with 20 additions and 1 deletions   Show diff stats
widgets/Seo.php
... ... @@ -176,7 +176,26 @@ class Seo extends Widget
176 176 $paginate = \Yii::$app->request->get('page', []);
177 177  
178 178 $meta = $this->selectSeoData(self::META, $filter,$priority);
179   -
  179 +
  180 + /**
  181 + * Sort and pagination SEO fix
  182 + */
  183 + if (strpos(\Yii::$app->request->url, 'per-page=') !== false) {
  184 + if (strpos(\Yii::$app->request->url, 'sort=') !== false || strpos(\Yii::$app->request->url, 'perPage=') !== false) {
  185 + $this->getView()->registerMetaTag([
  186 + 'name' => 'robots',
  187 + 'content' => 'noindex,nofollow'
  188 + ]);
  189 + break;
  190 + } else {
  191 + $this->getView()->registerMetaTag([
  192 + 'name' => 'robots',
  193 + 'content' => 'noindex,follow'
  194 + ]);
  195 + break;
  196 + }
  197 + }
  198 +
180 199 if(!empty($filter) && !$this->checkFilter($filter) && count($filter, COUNT_RECURSIVE) == 2 && $priority==3){
181 200 $key = array_keys ( $filter);
182 201 if(isset($key[0])){
... ...