Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit d1fb7b9

Browse files
committed
Fix truncation of meta description
1 parent bdcb6db commit d1fb7b9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

code/ExtraPageFieldsExtension.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,13 @@ public function onBeforeWrite()
6565
{
6666
parent::onBeforeWrite();
6767

68-
69-
if (strlen($this->owner->MetaDescription) > $this->MetaDescriptionLength) {
68+
$length = $this->owner->config()->MetaDescriptionLength ?: $this->MetaDescriptionLength;
69+
if (strlen($this->owner->MetaDescription) > $length) {
7070
/** @var Text $value */
7171
$value = $this->owner->dbObject('MetaDescription');
72-
$value = $value->LimitCharacters($this->MetaDescriptionLength);
72+
$value = $value->LimitCharacters($length);
7373
$this->owner->MetaDescription = $value;
7474
};
75-
76-
77-
//here
7875
}
7976
}
8077

0 commit comments

Comments
 (0)