Skip to content

Commit

Permalink
Craft 5 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Mar 1, 2024
1 parent e501bd8 commit 5994e31
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 4,519 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 5.0.0 - 2024-03-01
### Changed
- Add support for Craft 5

## 4.2.2 - 2024-02-16
### Fixed
- use pagination information on canonical (via @therealpecus)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "craft-plugin",
"minimum-stability": "dev",
"require": {
"php": "^8.0",
"craftcms/cms": "^4.0"
"php": "^8.2",
"craftcms/cms": "^5.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions resources/less/seo.less
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@

svg {
vertical-align: middle;
margin: auto;
}

h4 {
Expand Down
48 changes: 48 additions & 0 deletions resources/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/fields/SeoField.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public static function hasContentColumn (): bool
return true;
}

public static function icon (): string
{
return 'award';
}

// Instance
// -------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/models/data/SeoData.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ private function _getVariables ()

$variables = array_merge(
$variables,
$this->_element->toArray($this->_element->extraFields())
$this->_element->toArray($this->_element->extraFields(), [], false)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/models/data/SocialData.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getImage ()
$image = $image[0]['id'];

if (empty($image))
$image = $this->_fallback['image'];
$image = @$this->_fallback['image'];

if (!($image instanceof Asset))
$image = Craft::$app->getAssets()->getAssetById((int) $image);
Expand Down
6 changes: 3 additions & 3 deletions src/services/SitemapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function saveSitemap ($data)
public function getValidSections ()
{
return array_filter(
Craft::$app->sections->getAllSections(),
Craft::$app->entries->getAllSections(),
[$this, '_filterOutNoUrls']
);
}
Expand Down Expand Up @@ -281,7 +281,7 @@ public function core (array $variables)
$type = Category::instance();
$idHandle = 'groupId';
break;

case 'productTypes':
$type = \craft\commerce\elements\Product::instance();
$idHandle = 'typeId';
Expand Down Expand Up @@ -618,7 +618,7 @@ private function _generateIndex ($group, $id)
case 'productTypes':
$last = $this->_getUpdated(\craft\commerce\elements\Product::instance(), $id);
$pages = $this->_getPageCount(\craft\commerce\elements\Product::instance(), $id);
break;
break;

default:
$last = DateTimeHelper::currentUTCDateTime()->format('c');
Expand Down
6 changes: 3 additions & 3 deletions src/templates/_seo/settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@
{% endset %}
{{ forms.field({
label: 'Page Title',
instructions: 'Create a token for each part of your title. Clicking the lock will prevent the user from editing the contents of that token. Tokens use the same syntax as [Dynamic Entry Titles](https://docs.craftcms.com/v3/sections-and-entries.html#dynamic-entry-titles). They can be dragged to re-order.',
instructions: 'Create a token for each part of your title. Clicking the lock will prevent the user from editing the contents of that token. Tokens use the same syntax as [Dynamic Entry Titles](https://craftcms.com/docs/5.x/reference/element-types/entries.html#dynamic-entry-titles). They can be dragged to re-order.',
}, seoTitle) }}

{{ forms.textareaField({
label: 'Page Description',
instructions: 'This supports the same syntax as [Dynamic Entry Titles](https://docs.craftcms.com/v3/sections-and-entries.html#dynamic-entry-titles).',
instructions: 'This supports the same syntax as [Dynamic Entry Titles](https://craftcms.com/docs/5.x/reference/element-types/entries.html#dynamic-entry-titles).',
id: 'description',
name: 'description',
value: settings.description is empty and globalSettings.description is defined ? globalSettings.description : settings.description
Expand Down Expand Up @@ -180,4 +180,4 @@
},
robots
) }}
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion src/web/assets/css/seo.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/css/seo.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5994e31

Please sign in to comment.