Skip to content

Commit

Permalink
Move indexing over canonical section
Browse files Browse the repository at this point in the history
  • Loading branch information
aerni committed Jul 15, 2024
1 parent 309d1b6 commit f870966
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 86 deletions.
4 changes: 2 additions & 2 deletions resources/fieldsets/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ fields:
import: 'advanced-seo::open_graph'
-
import: 'advanced-seo::twitter'
-
import: 'advanced-seo::canonical_url'
-
import: 'advanced-seo::indexing'
-
import: 'advanced-seo::canonical_url'
-
import: 'advanced-seo::sitemap'
-
Expand Down
78 changes: 39 additions & 39 deletions src/Fields/ContentDefaultsFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ protected function sections(): array
$this->socialImagesGenerator(),
$this->openGraphImage(),
$this->twitterImage(),
$this->canonicalUrl(),
$this->indexing(),
$this->canonicalUrl(),
$this->sitemap(),
$this->jsonLd(),
];
Expand Down Expand Up @@ -283,6 +283,44 @@ protected function twitterImage(): array
];
}

protected function indexing(): array
{
return [
[
'handle' => 'seo_section_indexing',
'field' => [
'type' => 'section',
'display' => $this->trans('seo_section_indexing.display'),
'instructions' => $this->trans('seo_section_indexing.default_instructions'),
],
],
[
'handle' => 'seo_noindex',
'field' => [
'type' => 'toggle',
'display' => $this->trans('seo_noindex.display'),
'instructions' => $this->trans('seo_noindex.default_instructions'),
'default' => Defaults::data('collections')->get('seo_noindex'),
'listable' => 'hidden',
'localizable' => true,
'width' => 50,
],
],
[
'handle' => 'seo_nofollow',
'field' => [
'type' => 'toggle',
'display' => $this->trans('seo_nofollow.display'),
'instructions' => $this->trans('seo_nofollow.default_instructions'),
'default' => Defaults::data('collections')->get('seo_nofollow'),
'listable' => 'hidden',
'localizable' => true,
'width' => 50,
],
],
];
}

protected function canonicalUrl(): array
{
return [
Expand Down Expand Up @@ -347,44 +385,6 @@ protected function canonicalUrl(): array
];
}

protected function indexing(): array
{
return [
[
'handle' => 'seo_section_indexing',
'field' => [
'type' => 'section',
'display' => $this->trans('seo_section_indexing.display'),
'instructions' => $this->trans('seo_section_indexing.default_instructions'),
],
],
[
'handle' => 'seo_noindex',
'field' => [
'type' => 'toggle',
'display' => $this->trans('seo_noindex.display'),
'instructions' => $this->trans('seo_noindex.default_instructions'),
'default' => Defaults::data('collections')->get('seo_noindex'),
'listable' => 'hidden',
'localizable' => true,
'width' => 50,
],
],
[
'handle' => 'seo_nofollow',
'field' => [
'type' => 'toggle',
'display' => $this->trans('seo_nofollow.display'),
'instructions' => $this->trans('seo_nofollow.default_instructions'),
'default' => Defaults::data('collections')->get('seo_nofollow'),
'listable' => 'hidden',
'localizable' => true,
'width' => 50,
],
],
];
}

protected function sitemap(): array
{
return [
Expand Down
90 changes: 45 additions & 45 deletions src/Fields/OnPageSeoFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ protected function sections(): array
$this->socialImagesGenerator(),
$this->openGraphImage(),
$this->twitterImage(),
$this->canonicalUrl(),
$this->indexing(),
$this->canonicalUrl(),
$this->sitemap(),
$this->jsonLd(),
];
Expand Down Expand Up @@ -379,6 +379,50 @@ protected function twitterImage(): array
];
}

protected function indexing(): array
{
return [
[
'handle' => 'seo_section_indexing',
'field' => [
'type' => 'section',
'display' => $this->trans('seo_section_indexing.display'),
'instructions' => $this->trans('seo_section_indexing.instructions'),
],
],
[
'handle' => 'seo_noindex',
'field' => [
'type' => 'seo_source',
'display' => $this->trans('seo_noindex.display'),
'instructions' => $this->trans('seo_noindex.instructions'),
'default' => '@default',
'localizable' => true,
'classes' => 'toggle-fieldtype',
'width' => 50,
'field' => [
'type' => 'toggle',
],
],
],
[
'handle' => 'seo_nofollow',
'field' => [
'type' => 'seo_source',
'display' => $this->trans('seo_nofollow.display'),
'instructions' => $this->trans('seo_nofollow.instructions'),
'default' => '@default',
'localizable' => true,
'classes' => 'toggle-fieldtype',
'width' => 50,
'field' => [
'type' => 'toggle',
],
],
],
];
}

protected function canonicalUrl(): array
{
return [
Expand Down Expand Up @@ -465,50 +509,6 @@ protected function canonicalUrl(): array
];
}

protected function indexing(): array
{
return [
[
'handle' => 'seo_section_indexing',
'field' => [
'type' => 'section',
'display' => $this->trans('seo_section_indexing.display'),
'instructions' => $this->trans('seo_section_indexing.instructions'),
],
],
[
'handle' => 'seo_noindex',
'field' => [
'type' => 'seo_source',
'display' => $this->trans('seo_noindex.display'),
'instructions' => $this->trans('seo_noindex.instructions'),
'default' => '@default',
'localizable' => true,
'classes' => 'toggle-fieldtype',
'width' => 50,
'field' => [
'type' => 'toggle',
],
],
],
[
'handle' => 'seo_nofollow',
'field' => [
'type' => 'seo_source',
'display' => $this->trans('seo_nofollow.display'),
'instructions' => $this->trans('seo_nofollow.instructions'),
'default' => '@default',
'localizable' => true,
'classes' => 'toggle-fieldtype',
'width' => 50,
'field' => [
'type' => 'toggle',
],
],
],
];
}

protected function sitemap(): array
{
return [
Expand Down

0 comments on commit f870966

Please sign in to comment.