SEO : add tombi mori plugin
This commit is contained in:
parent
df2843123f
commit
8f9e75126e
64 changed files with 3719 additions and 44 deletions
33
site/plugins/kirby-seo/blueprints/fields/meta-group.yml
Normal file
33
site/plugins/kirby-seo/blueprints/fields/meta-group.yml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
type: group
|
||||
fields:
|
||||
metaHeadline:
|
||||
label: meta-headline
|
||||
type: headline
|
||||
numbered: false
|
||||
metaTitle:
|
||||
label: title-overwrite
|
||||
type: text
|
||||
placeholder: '{{ page.title }}'
|
||||
metaTemplate:
|
||||
label: meta-title-template
|
||||
type: text
|
||||
help: meta-title-template-help
|
||||
width: 2/3
|
||||
placeholder: '{{ page.metadata.metaTemplate }}'
|
||||
useTitleTemplate:
|
||||
label: use-title-template
|
||||
type: toggle
|
||||
help: use-title-template-help
|
||||
width: 1/3
|
||||
default: true
|
||||
text:
|
||||
- "{{ t('use-title-template-no') }}"
|
||||
- "{{ t('use-title-template-yes') }}"
|
||||
metaDescription:
|
||||
label: meta-description
|
||||
type: textarea
|
||||
help: meta-description-help
|
||||
placeholder: '{{ page.metadata.metaDescription }}'
|
||||
buttons: false
|
||||
seoLine1:
|
||||
type: line
|
||||
48
site/plugins/kirby-seo/blueprints/fields/og-group.yml
Normal file
48
site/plugins/kirby-seo/blueprints/fields/og-group.yml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
type: group
|
||||
fields:
|
||||
ogHeadline:
|
||||
label: og-headline
|
||||
type: headline
|
||||
numbered: false
|
||||
help: global-og-headline-help
|
||||
ogTemplate:
|
||||
label: og-title-template
|
||||
type: text
|
||||
width: 2/3
|
||||
help: meta-title-template-help
|
||||
placeholder: '{{ page.metadata.ogTemplate }}'
|
||||
useOgTemplate:
|
||||
label: use-title-template
|
||||
type: toggle
|
||||
help: use-title-template-help
|
||||
width: 1/3
|
||||
default: true
|
||||
text:
|
||||
- "{{ t('use-title-template-no') }}"
|
||||
- "{{ t('use-title-template-yes') }}"
|
||||
ogDescription:
|
||||
label: og-description
|
||||
type: textarea
|
||||
buttons: false
|
||||
placeholder: '{{ page.metadata.ogDescription }}'
|
||||
ogImage:
|
||||
label: og-image
|
||||
extends: seo/fields/og-image
|
||||
empty: og-image-empty
|
||||
twitterCardType:
|
||||
label: twitter-card-type
|
||||
width: 1/2
|
||||
placeholder: "{{ t('default-select') }} {{ t(site.twitterCardType) }}"
|
||||
type: select
|
||||
options:
|
||||
summary: "{{ t('summary') }}"
|
||||
summary_large_image: "{{ t('summary_large_image') }}"
|
||||
help: twitter-card-type-help
|
||||
twitterAuthor:
|
||||
label: twitter-author
|
||||
width: 1/2
|
||||
type: text
|
||||
before: '@'
|
||||
placeholder: '{{ page.metadata.twitterCreator }}'
|
||||
seoLine2:
|
||||
type: line
|
||||
31
site/plugins/kirby-seo/blueprints/fields/og-image.php
Normal file
31
site/plugins/kirby-seo/blueprints/fields/og-image.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\App;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
return function (App $kirby) {
|
||||
$blueprint = [
|
||||
'type' => 'files',
|
||||
'multiple' => false,
|
||||
'uploads' => [],
|
||||
'query' => Str::contains($kirby->path(), '/site') && !Str::contains($kirby->path(), 'pages') ? 'site.images' : 'page.images' // small hack to get context for field using api path
|
||||
];
|
||||
|
||||
if ($parent = option('tobimori.seo.files.parent')) {
|
||||
$blueprint['uploads'] = [
|
||||
'parent' => $parent
|
||||
];
|
||||
$blueprint['query'] = "{$parent}.images";
|
||||
}
|
||||
|
||||
if ($template = option('tobimori.seo.files.template')) {
|
||||
$blueprint['uploads'] = [
|
||||
...$blueprint['uploads'],
|
||||
'template' => $template
|
||||
];
|
||||
|
||||
$blueprint['query'] = "{$blueprint['query']}.filterBy('template', '{$template}')";
|
||||
}
|
||||
|
||||
return $blueprint;
|
||||
};
|
||||
55
site/plugins/kirby-seo/blueprints/fields/robots.php
Normal file
55
site/plugins/kirby-seo/blueprints/fields/robots.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\App;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\Str;
|
||||
use tobimori\Seo\Meta;
|
||||
|
||||
return function (App $kirby) {
|
||||
if (!$kirby->option('tobimori.seo.robots.active') || !$kirby->option('tobimori.seo.robots.pageSettings')) {
|
||||
return [
|
||||
'type' => 'hidden'
|
||||
];
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'robotsHeadline' => [
|
||||
'label' => 'robots',
|
||||
'type' => 'headline',
|
||||
'numbered' => false,
|
||||
]
|
||||
];
|
||||
|
||||
$page = Meta::currentPage();
|
||||
foreach ($kirby->option('tobimori.seo.robots.types') as $robots) {
|
||||
$upper = Str::ucfirst($robots);
|
||||
|
||||
$fields["robots{$upper}"] = [
|
||||
'label' => "robots-{$robots}",
|
||||
'type' => 'toggles',
|
||||
'help' => "robots-{$robots}-help",
|
||||
'width' => '1/2',
|
||||
'default' => 'default',
|
||||
'reset' => false,
|
||||
'options' => [
|
||||
'default' => $page ?
|
||||
A::join([
|
||||
t('default-select'),
|
||||
$page->metadata()->get("robots{$upper}", ['fields'])->toBool() ? t('yes') : t('no')
|
||||
], ' ')
|
||||
: t('default-select'),
|
||||
'true' => t('yes'),
|
||||
'false' => t('no'),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$fields['seoLine3'] = [
|
||||
'type' => 'line'
|
||||
];
|
||||
|
||||
return [
|
||||
'type' => 'group',
|
||||
'fields' => $fields,
|
||||
];
|
||||
};
|
||||
49
site/plugins/kirby-seo/blueprints/fields/site-robots.php
Normal file
49
site/plugins/kirby-seo/blueprints/fields/site-robots.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\App;
|
||||
|
||||
return function (App $kirby) {
|
||||
if (!$kirby->option('tobimori.seo.robots.active') || !$kirby->option('tobimori.seo.robots.pageSettings')) {
|
||||
return [
|
||||
'type' => 'hidden'
|
||||
];
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'robotsHeadline' => [
|
||||
'label' => 'robots',
|
||||
'type' => 'headline',
|
||||
'numbered' => false,
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($kirby->option('tobimori.seo.robots.types') as $robots) {
|
||||
$index = $kirby->option('tobimori.seo.robots.index');
|
||||
if (is_callable($index)) {
|
||||
$index = $index();
|
||||
}
|
||||
|
||||
$fields["robots{$robots}"] = [
|
||||
'label' => "robots-{$robots}",
|
||||
'type' => 'toggles',
|
||||
'help' => "robots-{$robots}-help",
|
||||
'width' => '1/2',
|
||||
'default' => 'default',
|
||||
'reset' => false,
|
||||
'options' => [
|
||||
'default' => t('default-select') . ' ' . ($index ? t('yes') : t('no')),
|
||||
'true' => t('yes'),
|
||||
'false' => t('no'),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$fields['seoLine3'] = [
|
||||
'type' => 'line'
|
||||
];
|
||||
|
||||
return [
|
||||
'type' => 'group',
|
||||
'fields' => $fields,
|
||||
];
|
||||
};
|
||||
30
site/plugins/kirby-seo/blueprints/fields/social-media.php
Normal file
30
site/plugins/kirby-seo/blueprints/fields/social-media.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Social Media Accounts field
|
||||
* Allows social media account list to be filled by config options
|
||||
*/
|
||||
|
||||
use Kirby\Cms\App;
|
||||
|
||||
return function (App $kirby) {
|
||||
$fields = [];
|
||||
|
||||
foreach ($kirby->option('tobimori.seo.socialMedia') as $key => $value) {
|
||||
if ($value) {
|
||||
$fields[$key] = [
|
||||
'label' => ucfirst($key),
|
||||
'type' => 'url',
|
||||
'icon' => strtolower($key),
|
||||
'placeholder' => $value
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'label' => 'social-media-accounts',
|
||||
'type' => 'object',
|
||||
'help' => 'social-media-accounts-help',
|
||||
'fields' => $fields
|
||||
];
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue