use Cubist\Backpack\app\Magic\Menu\Menu;
use Cubist\Backpack\app\Magic\Menu\PageItem;
use Cubist\Backpack\app\Magic\Models\Locale;
+use Cubist\Backpack\app\Magic\Models\Settings;
use Illuminate\Http\Request;
class CubistSEOController extends CubistFrontController
{
- protected function isRobotsEnabled()
+ public static function isRobotsEnabled()
{
if (!config('cubist.seo_robots', true)) {
return false;
}
- $robots = $this->data['global']->get('robots');
+ $robots = Settings::getData()->get('robots');
if (null === $robots) {
return false;
}
{
$response = ['User-agent: *'];
- if (!$this->isRobotsEnabled()) {
+ if (!self::isRobotsEnabled()) {
$response[] = 'Disallow: /';
} else {
$response[] = 'Disallow: /admin/';
$res = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$res .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">' . "\n";
- if ($this->isRobotsEnabled()) {
+ if (self::isRobotsEnabled()) {
$pages = Menu::getAllNavigablePages();
foreach ($pages as $url => $page) {
if ($page instanceof PageItem && !$page->isRobots()) {
namespace Cubist\Backpack\app\Magic;
+use Cubist\Backpack\app\Http\Controllers\CubistSEOController;
use Cubist\Backpack\app\Magic\Models\Settings;
class PageData extends EntityData
public function getSocialImage()
{
$settings = Settings::getData();
- $image = $this->getImageURL('social_image','', $settings->getImageURL('social_image'));
+ $image = $this->getImageURL('social_image', '', $settings->getImageURL('social_image'));
if (!$image) {
return null;
public function getRobots()
{
- return ($this->get('robots', true) && config('cubist.seo_robots', true))
+ return ($this->get('robots', true) && CubistSEOController::isRobotsEnabled())
? 'index,follow' : 'noindex,nofollow';
}
}