Added additional robots meta fields to CMS pages (#4685)

Credit to @FlusherDock1
This commit is contained in:
Nick Khaetsky 2019-12-18 19:16:36 +03:00 committed by Luke Towers
parent 25fb9ce1c0
commit 8303e0dbb2
4 changed files with 49 additions and 0 deletions

View File

@ -28,6 +28,9 @@ class Page extends CmsCompoundObject
'is_hidden',
'meta_title',
'meta_description',
'meta_robots_noindex',
'meta_robots_nofollow',
'meta_robots_noarchive',
'markup',
'settings',
'code'
@ -112,6 +115,19 @@ class Page extends CmsCompoundObject
return $result;
}
/**
* Helper that returns formatted robots tags.
* @return string
*/
public function getMetaRobotsAttribute()
{
$options = [];
$options[] = $this->meta_robots_noindex ? 'noindex' : 'index';
$options[] = $this->meta_robots_nofollow ? 'nofollow' : 'follow';
$options[] = $this->meta_robots_noarchive ? 'noarchive' : 'archive';
return implode(',', $options);
}
/**
* Helper that makes a URL for a page in the active theme.
* @param mixed $page Specifies the Cms Page file name.

View File

@ -59,6 +59,31 @@ tabs:
type: textarea
size: tiny
settings[meta_robots_noindex]:
tab: cms::lang.editor.meta
label: cms::lang.editor.meta_robots_noindex
on: backend::lang.list.column_switch_true
off: backend::lang.list.column_switch_false
span: auto
type: switch
comment: cms::lang.editor.meta_robots_noindex_comment
settings[meta_robots_noarchive]:
tab: cms::lang.editor.meta
label: cms::lang.editor.meta_robots_noarchive
on: backend::lang.list.column_switch_true
off: backend::lang.list.column_switch_false
span: auto
type: switch
settings[meta_robots_nofollow]:
tab: cms::lang.editor.meta
label: cms::lang.editor.meta_robots_nofollow
on: backend::lang.list.column_switch_true
off: backend::lang.list.column_switch_false
span: auto
type: switch
settings[is_hidden]:
tab: cms::lang.editor.settings
label: cms::lang.editor.hidden

View File

@ -175,6 +175,10 @@ return [
'meta' => 'Meta',
'meta_title' => 'Meta Title',
'meta_description' => 'Meta Description',
'meta_robots_noindex' => 'Prevent search engines from indexing this page?',
'meta_robots_noindex_comment' => 'Regular users will still be able to visit a page hidden from search engines.',
'meta_robots_nofollow' => 'Prevent search engines from following the links on this page?',
'meta_robots_noarchive' => 'Prevent search engines from archiving the page?',
'markup' => 'Markup',
'code' => 'Code',
'content' => 'Content',

View File

@ -175,6 +175,10 @@ return [
'meta' => 'Метатеги',
'meta_title' => 'Заголовок (meta title)',
'meta_description' => 'Описание (meta description)',
'meta_robots_noindex' => 'Запретить поисковым системам индексировать эту страницу?',
'meta_robots_noindex_comment' => 'Обычные пользователи по-прежнему смогут посещать страницы, скрытые от поисковых систем.',
'meta_robots_nofollow' => 'Запретить поисковым системам следовать по ссылкам на этой странице?',
'meta_robots_noarchive' => 'Запретить поисковым системам архивировать эту страницу?',
'markup' => 'Разметка',
'code' => 'Код',
'content' => 'Содержание',