Build "seo-meta-tags" into core
This commit is contained in:
parent
3bf9b18d64
commit
afb65615b0
|
|
@ -237,7 +237,14 @@ class AdminController extends Controller
|
|||
})
|
||||
->handle();
|
||||
|
||||
return view('admin.options')->with('forms', compact('general', 'resources', 'announ'));
|
||||
$meta = Option::form('meta', OptionForm::AUTO_DETECT, function ($form) {
|
||||
$form->text('meta_keywords')->hint(OptionForm::AUTO_DETECT);
|
||||
$form->text('meta_description')->hint(OptionForm::AUTO_DETECT);
|
||||
$form->textarea('meta_extras')->rows(3);
|
||||
})->handle();
|
||||
|
||||
return view('admin.options')
|
||||
->with('forms', compact('general', 'resources', 'announ', 'meta'));
|
||||
}
|
||||
|
||||
public function getUserData(Request $request)
|
||||
|
|
|
|||
|
|
@ -150,3 +150,14 @@ resources:
|
|||
The CDN URL you give must refer to a mirror of <code>/public</code> directory,
|
||||
all the files of that directory will be loaded as CDN.<br>
|
||||
<b>How to verify?</b> Verify if <code>{Your CDN URL}/app/index.js</code> can be accessed.
|
||||
|
||||
meta:
|
||||
title: SEO <meta> tags
|
||||
meta_keywords:
|
||||
title: Keywords
|
||||
hint: Split with commas.
|
||||
meta_description:
|
||||
title: Description
|
||||
hint: Description defined in "general options" will be used if you left it empty.
|
||||
meta_extras:
|
||||
title: Other Custom <meta> Tags
|
||||
|
|
|
|||
|
|
@ -149,3 +149,14 @@ resources:
|
|||
description: |
|
||||
填写的 CDN 地址必须是 <code>/public</code> 目录的镜像,此目录下的所有文件都将会从 CDN 加载。<br>
|
||||
<b>测试方法</b>:检查 <code>{填写的地址}/app/index.js</code> 是否能够访问。
|
||||
|
||||
meta:
|
||||
title: SEO <meta> 标签
|
||||
meta_keywords:
|
||||
title: 关键词
|
||||
hint: 使用半角逗号分隔
|
||||
meta_description:
|
||||
title: 描述
|
||||
hint: 留空以使用 站点配置 中的站点描述
|
||||
meta_extras:
|
||||
title: 其它自定义 <meta> 标签
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
{!! $forms['announ']->render() !!}
|
||||
|
||||
{!! $forms['resources']->render() !!}
|
||||
|
||||
{!! $forms['meta']->render() !!}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
{!! bs_favicon() !!}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@include('common.seo-meta-tags')
|
||||
<!-- App Styles -->
|
||||
@include('common.dependencies.style')
|
||||
|
||||
|
|
|
|||
3
resources/views/common/seo-meta-tags.blade.php
Normal file
3
resources/views/common/seo-meta-tags.blade.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<meta name="keywords" content="{{ option('meta_keywords') }}">
|
||||
<meta name="description" content="{{ option('meta_description') }}">
|
||||
{!! option('meta_extras') !!}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@include('common.seo-meta-tags')
|
||||
<!-- App Styles -->
|
||||
@include('common.dependencies.style', ['module' => 'home'])
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@include('common.seo-meta-tags')
|
||||
<!-- App Styles -->
|
||||
@include('common.dependencies.style')
|
||||
|
||||
|
|
|
|||
|
|
@ -149,6 +149,16 @@ class AdminControllerTest extends BrowserKitTestCase
|
|||
->type('', 'cdn_address')
|
||||
->press('submit_resources');
|
||||
$this->visit('/')->dontSee('url/app/index.js');
|
||||
|
||||
$this->visit('/admin/options')
|
||||
->type('kw', 'meta_keywords')
|
||||
->type('desc', 'meta_description')
|
||||
->type('<!-- nothing -->', 'meta_extras')
|
||||
->press('submit_meta');
|
||||
$this->visit('/')
|
||||
->see('<meta name="keywords" content="kw">')
|
||||
->see('<meta name="description" content="desc">')
|
||||
->see('<!-- nothing -->');
|
||||
}
|
||||
|
||||
public function testUsers()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user