chore: update kirby-seo plugin to v2.0.0-alpha.12
Update plugin from v1.1.2 to v2.0.0-alpha.12 for Kirby 5 compatibility. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ff215de723
commit
04a14a7f1f
70 changed files with 6142 additions and 3 deletions
34
site/plugins/kirby-seo/blueprints/fields/meta-group.yml
Normal file
34
site/plugins/kirby-seo/blueprints/fields/meta-group.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
type: group
|
||||
fields:
|
||||
_metaHeadline:
|
||||
label: seo.page.meta.headline
|
||||
type: headline
|
||||
numbered: false
|
||||
metaTitle:
|
||||
label: seo.fields.titleOverwrite.label
|
||||
type: seo-writer
|
||||
ai: title
|
||||
placeholder: "{{ page.title }}"
|
||||
metaTemplate:
|
||||
extends: seo/fields/title-template
|
||||
label: seo.fields.metaTitleTemplate.label
|
||||
help: seo.fields.metaTitleTemplate.help
|
||||
width: 2/3
|
||||
placeholder: "{{ page.metadata.metaTemplate }}"
|
||||
useTitleTemplate:
|
||||
label: seo.fields.useTitleTemplate.label
|
||||
type: toggle
|
||||
help: seo.fields.useTitleTemplate.help
|
||||
width: 1/3
|
||||
default: true
|
||||
text:
|
||||
- "{{ t('seo.fields.useTitleTemplate.no') }}"
|
||||
- "{{ t('seo.fields.useTitleTemplate.yes') }}"
|
||||
metaDescription:
|
||||
label: seo.fields.metaDescription.label
|
||||
type: seo-writer
|
||||
ai: description
|
||||
help: seo.fields.metaDescription.help
|
||||
placeholder: "{{ page.metadata.metaDescription }}"
|
||||
_seoLine1:
|
||||
type: line
|
||||
42
site/plugins/kirby-seo/blueprints/fields/og-group.yml
Normal file
42
site/plugins/kirby-seo/blueprints/fields/og-group.yml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
type: group
|
||||
fields:
|
||||
_ogHeadline:
|
||||
label: seo.page.og.headline
|
||||
type: headline
|
||||
numbered: false
|
||||
help: seo.site.og.headline.help
|
||||
ogTemplate:
|
||||
extends: seo/fields/title-template
|
||||
label: seo.fields.ogTitleTemplate.label
|
||||
width: 2/3
|
||||
help: seo.fields.metaTitleTemplate.help
|
||||
placeholder: "{{ page.metadata.ogTemplate }}"
|
||||
useOgTemplate:
|
||||
label: seo.fields.useTitleTemplate.label
|
||||
type: toggle
|
||||
help: seo.fields.useTitleTemplate.help
|
||||
width: 1/3
|
||||
default: true
|
||||
text:
|
||||
- "{{ t('seo.fields.useTitleTemplate.no') }}"
|
||||
- "{{ t('seo.fields.useTitleTemplate.yes') }}"
|
||||
ogDescription:
|
||||
label: seo.fields.ogDescription.label
|
||||
type: seo-writer
|
||||
ai: og-description
|
||||
placeholder: "{{ page.metadata.ogDescription }}"
|
||||
ogImage:
|
||||
label: seo.fields.ogImage.label
|
||||
extends: seo/fields/og-image
|
||||
empty: seo.fields.ogImage.empty
|
||||
cropOgImage:
|
||||
label: seo.fields.cropOgImage.label
|
||||
type: select
|
||||
width: 1/1
|
||||
placeholder: "{{ t('seo.common.default') }} {{ site.cropOgImage.toBool ? t('seo.common.yes') : t('seo.common.no') }}"
|
||||
options:
|
||||
"true": "{{ t('seo.common.yes') }}"
|
||||
"false": "{{ t('seo.common.no') }}"
|
||||
help: seo.fields.cropOgImage.help
|
||||
_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' => 'model.images'
|
||||
];
|
||||
|
||||
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;
|
||||
};
|
||||
56
site/plugins/kirby-seo/blueprints/fields/robots.php
Normal file
56
site/plugins/kirby-seo/blueprints/fields/robots.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\App;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\Str;
|
||||
use tobimori\Seo\Meta;
|
||||
use tobimori\Seo\Seo;
|
||||
|
||||
return function (App $kirby) {
|
||||
if (!Seo::option('robots.active') || !Seo::option('robots.pageSettings')) {
|
||||
return [
|
||||
'type' => 'hidden'
|
||||
];
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'_robotsHeadline' => [
|
||||
'label' => 'seo.fields.robots.label',
|
||||
'type' => 'headline',
|
||||
'numbered' => false,
|
||||
]
|
||||
];
|
||||
|
||||
$page = Meta::currentPage();
|
||||
foreach ($kirby->option('tobimori.seo.robots.types') as $robots) {
|
||||
$upper = Str::ucfirst($robots);
|
||||
|
||||
$fields["robots{$upper}"] = [
|
||||
'label' => "seo.fields.robots.{$robots}.label",
|
||||
'type' => 'toggles',
|
||||
'help' => "seo.fields.robots.{$robots}.help",
|
||||
'width' => '1/2',
|
||||
'default' => 'default',
|
||||
'reset' => false,
|
||||
'options' => [
|
||||
'default' => $page ?
|
||||
A::join([
|
||||
t('seo.common.default'),
|
||||
$page->metadata()->get("robots{$upper}", ['fields'])->toBool() ? t('seo.common.yes') : t('seo.common.no')
|
||||
], ' ')
|
||||
: t('seo.common.default'),
|
||||
'true' => t('seo.common.yes'),
|
||||
'false' => t('seo.common.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' => 'seo.fields.robots.label',
|
||||
'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' => "seo.fields.robots.{$robots}.label",
|
||||
'type' => 'toggles',
|
||||
'help' => "seo.fields.robots.{$robots}.help",
|
||||
'width' => '1/2',
|
||||
'default' => 'default',
|
||||
'reset' => false,
|
||||
'options' => [
|
||||
'default' => t('seo.common.default') . ' ' . ($index ? t('seo.common.yes') : t('seo.common.no')),
|
||||
'true' => t('seo.common.yes'),
|
||||
'false' => t('seo.common.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 tobimori\Seo\Seo;
|
||||
|
||||
return function () {
|
||||
$fields = [];
|
||||
|
||||
foreach (Seo::option('socialMedia') as $key => $value) {
|
||||
if ($value) {
|
||||
$fields[$key] = [
|
||||
'label' => ucfirst($key),
|
||||
'type' => 'url',
|
||||
'icon' => strtolower($key),
|
||||
'placeholder' => $value
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'label' => 'seo.fields.socialMediaAccounts.label',
|
||||
'type' => 'object',
|
||||
'help' => 'seo.fields.socialMediaAccounts.help',
|
||||
'fields' => $fields
|
||||
];
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
type: seo-writer
|
||||
nodes:
|
||||
- seoTemplateTitle
|
||||
- seoTemplateSiteTitle
|
||||
toolbar:
|
||||
inline: false
|
||||
60
site/plugins/kirby-seo/blueprints/page.php
Normal file
60
site/plugins/kirby-seo/blueprints/page.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
use tobimori\Seo\Seo;
|
||||
|
||||
return [
|
||||
'label' => 'seo.tabs.seo',
|
||||
'icon' => 'search',
|
||||
'columns' => [
|
||||
'main' => [
|
||||
'width' => '7/12',
|
||||
'fields' => [
|
||||
'metaGroup' => 'seo/fields/meta-group',
|
||||
'ogGroup' => 'seo/fields/og-group',
|
||||
'robots' => 'seo/fields/robots',
|
||||
'metaInherit' => [
|
||||
'label' => 'seo.fields.inheritSettings.label',
|
||||
'type' => 'multiselect',
|
||||
'help' => 'seo.fields.inheritSettings.help',
|
||||
'options' => [
|
||||
'metaTemplate' => [
|
||||
'*' => 'seo.fields.metaTitleTemplate.label'
|
||||
],
|
||||
'metaDescription' => [
|
||||
'*' => 'seo.fields.metaDescription.label'
|
||||
],
|
||||
'ogTemplate' => [
|
||||
'*' => 'seo.fields.ogTitleTemplate.label'
|
||||
],
|
||||
'ogDescription' => [
|
||||
'*' => 'seo.fields.ogDescription.label'
|
||||
],
|
||||
'ogImage' => [
|
||||
'*' => 'seo.fields.ogImage.label'
|
||||
],
|
||||
'cropOgImage' => [
|
||||
'*' => 'seo.fields.cropOgImage.label'
|
||||
],
|
||||
'robots' => [
|
||||
'*' => 'seo.fields.robots.label'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'sidebar' => [
|
||||
'width' => '5/12',
|
||||
'sticky' => true,
|
||||
'sections' => [
|
||||
'seoPreview' => [
|
||||
'type' => 'seo-preview'
|
||||
],
|
||||
...(Seo::option('searchConsole.enabled') ? [
|
||||
'seoSearchConsole' => [
|
||||
'type' => 'seo-search-console'
|
||||
]
|
||||
] : [])
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
15
site/plugins/kirby-seo/blueprints/seo.php
Normal file
15
site/plugins/kirby-seo/blueprints/seo.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\App;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
return function (App $kirby) {
|
||||
$path = $kirby->request()->url()->toString();
|
||||
$isSite = Str::contains($path, '/site') && !Str::contains($path, '/pages/');
|
||||
|
||||
if ($isSite) {
|
||||
return require __DIR__ . '/site.php';
|
||||
}
|
||||
|
||||
return require __DIR__ . '/page.php';
|
||||
};
|
||||
95
site/plugins/kirby-seo/blueprints/site.php
Normal file
95
site/plugins/kirby-seo/blueprints/site.php
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
use tobimori\Seo\Seo;
|
||||
|
||||
return [
|
||||
'label' => 'seo.tabs.seo',
|
||||
'icon' => 'search',
|
||||
'columns' => [
|
||||
'main' => [
|
||||
'width' => '7/12',
|
||||
'fields' => [
|
||||
'_metaHeadline' => [
|
||||
'label' => 'seo.site.meta.headline',
|
||||
'type' => 'headline',
|
||||
'help' => 'seo.site.meta.headline.help'
|
||||
],
|
||||
'metaTemplate' => [
|
||||
'extends' => 'seo/fields/title-template',
|
||||
'label' => 'seo.fields.metaTitleTemplate.label',
|
||||
'help' => 'seo.fields.metaTitleTemplate.help'
|
||||
],
|
||||
'metaDescription' => [
|
||||
'label' => 'seo.fields.metaDescription.label',
|
||||
'type' => 'seo-writer',
|
||||
'ai' => 'site-description',
|
||||
'help' => 'seo.fields.metaDescription.help'
|
||||
],
|
||||
'_seoLine1' => [
|
||||
'type' => 'line'
|
||||
],
|
||||
'_ogHeadline' => [
|
||||
'label' => 'seo.site.og.headline',
|
||||
'type' => 'headline',
|
||||
'numbered' => false,
|
||||
'help' => 'seo.site.og.headline.help'
|
||||
],
|
||||
'ogTemplate' => [
|
||||
'extends' => 'seo/fields/title-template',
|
||||
'label' => 'seo.fields.ogTitleTemplate.label',
|
||||
'default' => '{{ title }}',
|
||||
'help' => 'seo.fields.metaTitleTemplate.help',
|
||||
'placeholder' => '{{ site.metaTemplate }}'
|
||||
],
|
||||
'ogDescription' => [
|
||||
'label' => 'seo.fields.ogDescription.label',
|
||||
'type' => 'seo-writer',
|
||||
'ai' => 'og-site-description',
|
||||
'placeholder' => '{{ site.metaDescription }}'
|
||||
],
|
||||
'ogSiteName' => [
|
||||
'label' => 'seo.fields.ogSiteName.label',
|
||||
'type' => 'text',
|
||||
'default' => '{{ site.title }}',
|
||||
'placeholder' => '{{ site.title }}',
|
||||
'width' => '1/2'
|
||||
],
|
||||
'ogImage' => [
|
||||
'label' => 'seo.fields.ogImage.label',
|
||||
'extends' => 'seo/fields/og-image',
|
||||
'empty' => 'seo.fields.ogImage.empty',
|
||||
'width' => '1/2'
|
||||
],
|
||||
'cropOgImage' => [
|
||||
'label' => 'seo.fields.cropOgImage.label',
|
||||
'type' => 'toggle',
|
||||
'default' => true,
|
||||
'text' => [
|
||||
"{{ t('seo.common.no') }}",
|
||||
"{{ t('seo.common.yes') }}"
|
||||
],
|
||||
'help' => 'seo.fields.cropOgImage.help'
|
||||
],
|
||||
'_seoLine2' => [
|
||||
'type' => 'line'
|
||||
],
|
||||
'robots' => 'seo/fields/site-robots',
|
||||
'socialMediaAccounts' => 'seo/fields/social-media'
|
||||
]
|
||||
],
|
||||
'sidebar' => [
|
||||
'width' => '5/12',
|
||||
'sticky' => true,
|
||||
'sections' => [
|
||||
'seoPreview' => [
|
||||
'type' => 'seo-preview'
|
||||
],
|
||||
...(Seo::option('searchConsole.enabled') ? [
|
||||
'seoSearchConsole' => [
|
||||
'type' => 'seo-search-console'
|
||||
]
|
||||
] : [])
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue