Commit 7b0c8d587a96dc41fc8ceb5596838073c8cf2069

Authored by Alexey Boroda
1 parent c62fdb51

-Show real robots in layout (didn't worked)

Showing 1 changed file with 17 additions and 2 deletions   Show diff stats
@@ -26,6 +26,7 @@ class Seo extends Widget @@ -26,6 +26,7 @@ class Seo extends Widget
26 public static $optionsList; 26 public static $optionsList;
27 protected static $check_url; 27 protected static $check_url;
28 protected static $check_url_bool; 28 protected static $check_url_bool;
  29 + protected static $robots_string = '';
29 30
30 31
31 const SEO_TEXT = 'seo_text'; 32 const SEO_TEXT = 'seo_text';
@@ -185,6 +186,7 @@ class Seo extends Widget @@ -185,6 +186,7 @@ class Seo extends Widget
185 'name' => 'robots', 186 'name' => 'robots',
186 'content' => 'noindex,nofollow' 187 'content' => 'noindex,nofollow'
187 ]); 188 ]);
  189 + self::$robots_string = 'noindex,nofollow';
188 break; 190 break;
189 } 191 }
190 if (strpos(\Yii::$app->request->url, 'per-page=') !== false) { 192 if (strpos(\Yii::$app->request->url, 'per-page=') !== false) {
@@ -192,6 +194,7 @@ class Seo extends Widget @@ -192,6 +194,7 @@ class Seo extends Widget
192 'name' => 'robots', 194 'name' => 'robots',
193 'content' => 'noindex,follow' 195 'content' => 'noindex,follow'
194 ]); 196 ]);
  197 + self::$robots_string = 'noindex,follow';
195 break; 198 break;
196 } 199 }
197 200
@@ -204,6 +207,7 @@ class Seo extends Widget @@ -204,6 +207,7 @@ class Seo extends Widget
204 'name' => 'robots', 207 'name' => 'robots',
205 'content' => $metaGroup->meta_robots 208 'content' => $metaGroup->meta_robots
206 ]); 209 ]);
  210 + self::$robots_string = $metaGroup->meta_robots;
207 break; 211 break;
208 } 212 }
209 } 213 }
@@ -216,14 +220,14 @@ class Seo extends Widget @@ -216,14 +220,14 @@ class Seo extends Widget
216 'name' => 'robots', 220 'name' => 'robots',
217 'content' => $meta 221 'content' => $meta
218 ]); 222 ]);
219 - 223 + self::$robots_string = $meta;
220 } else if(!empty($filter['special'])){ 224 } else if(!empty($filter['special'])){
221 225
222 $this->getView()->registerMetaTag([ 226 $this->getView()->registerMetaTag([
223 'name' => 'robots', 227 'name' => 'robots',
224 'content' => 'noindex,nofollow' 228 'content' => 'noindex,nofollow'
225 ]); 229 ]);
226 - 230 + self::$robots_string = 'noindex,nofollow';
227 } else if ( 231 } else if (
228 isset($filter['brands']) && count($filter['brands']) > 1 232 isset($filter['brands']) && count($filter['brands']) > 1
229 || isset($filter) && $this->checkFilter($filter) 233 || isset($filter) && $this->checkFilter($filter)
@@ -234,6 +238,7 @@ class Seo extends Widget @@ -234,6 +238,7 @@ class Seo extends Widget
234 'name' => 'robots', 238 'name' => 'robots',
235 'content' => 'noindex,nofollow' 239 'content' => 'noindex,nofollow'
236 ]); 240 ]);
  241 + self::$robots_string = 'noindex,nofollow';
237 242
238 } else if ( 243 } else if (
239 isset($filter['brands']) && count($filter['brands']) > 1 && isset($filter) && count($filter, COUNT_RECURSIVE) >= 2 244 isset($filter['brands']) && count($filter['brands']) > 1 && isset($filter) && count($filter, COUNT_RECURSIVE) >= 2
@@ -245,18 +250,23 @@ class Seo extends Widget @@ -245,18 +250,23 @@ class Seo extends Widget
245 'name' => 'robots', 250 'name' => 'robots',
246 'content' => 'noindex,nofollow' 251 'content' => 'noindex,nofollow'
247 ]); 252 ]);
  253 + self::$robots_string = 'noindex,nofollow';
  254 +
248 } else if(!empty($this->{Seo::META})){ 255 } else if(!empty($this->{Seo::META})){
249 256
250 $this->getView()->registerMetaTag([ 257 $this->getView()->registerMetaTag([
251 'name' => 'robots', 258 'name' => 'robots',
252 'content' => $this->{Seo::META} 259 'content' => $this->{Seo::META}
253 ]); 260 ]);
  261 + self::$robots_string = $this->{Seo::META};
  262 +
254 } else { 263 } else {
255 264
256 $this->getView()->registerMetaTag([ 265 $this->getView()->registerMetaTag([
257 'name' => 'robots', 266 'name' => 'robots',
258 'content' => 'index,follow' 267 'content' => 'index,follow'
259 ]); 268 ]);
  269 + self::$robots_string = 'index,follow';
260 } 270 }
261 271
262 272
@@ -268,6 +278,11 @@ class Seo extends Widget @@ -268,6 +278,11 @@ class Seo extends Widget
268 278
269 } 279 }
270 280
  281 + public static function getRobotsString()
  282 + {
  283 + return self::$robots_string;
  284 + }
  285 +
271 /** 286 /**
272 * @param $str 287 * @param $str
273 * @return mixed 288 * @return mixed