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