From ca585b24866b2e757ea781f3b634546828049374 Mon Sep 17 00:00:00 2001 From: Erwin Romkes <61180307+erwinromkes@users.noreply.github.com> Date: Fri, 1 Jul 2022 14:28:29 +0200 Subject: [PATCH 1/5] Add description for page This gets the excerpt (custom or excerpt from blog) and set this as the page description. Problem now is that for every blog don't have an description so the fallback is triggered. That means multiple pages have the same description = bad SEO. --- Controller/Blog/View.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Controller/Blog/View.php b/Controller/Blog/View.php index b39a9e2..50eff56 100644 --- a/Controller/Blog/View.php +++ b/Controller/Blog/View.php @@ -71,6 +71,12 @@ public function execute() } $this->resultPage->getConfig()->getTitle()->set($page['title']['rendered']); + + $descriptionRaw = $page['excerpt']['rendered']; + if($descriptionRaw) { + $description = trim(strip_tags($descriptionRaw)); + $this->resultPage->getConfig()->setDescription($description); + } $page = $this->resultFactory->create(ResultFactory::TYPE_PAGE); $layout = $page->getLayout(); From 99b1d111363b55eb9759773d3fcc14e41ca84850 Mon Sep 17 00:00:00 2001 From: Erwin Romkes <61180307+erwinromkes@users.noreply.github.com> Date: Fri, 1 Jul 2022 14:31:06 +0200 Subject: [PATCH 2/5] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fda894a..a1820ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Add meta description from post excerpt ## [0.10.3] - 2022-06-29 ### Fixed From 10d4343afc84b004bf5cdb0a75a43372d58d2f00 Mon Sep 17 00:00:00 2001 From: Erwin Romkes <61180307+erwinromkes@users.noreply.github.com> Date: Fri, 1 Jul 2022 14:32:58 +0200 Subject: [PATCH 3/5] Extra space --- Controller/Blog/View.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/Blog/View.php b/Controller/Blog/View.php index 50eff56..08cf30a 100644 --- a/Controller/Blog/View.php +++ b/Controller/Blog/View.php @@ -73,7 +73,7 @@ public function execute() $this->resultPage->getConfig()->getTitle()->set($page['title']['rendered']); $descriptionRaw = $page['excerpt']['rendered']; - if($descriptionRaw) { + if ($descriptionRaw) { $description = trim(strip_tags($descriptionRaw)); $this->resultPage->getConfig()->setDescription($description); } From d135caf60eb353943f8feae48fa814a63ef381c8 Mon Sep 17 00:00:00 2001 From: Erwin Romkes <61180307+erwinromkes@users.noreply.github.com> Date: Mon, 4 Jul 2022 12:21:28 +0200 Subject: [PATCH 4/5] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1820ce..4ab092f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.10.3] - 2022-07-04 ### Added - Add meta description from post excerpt From 54cf5e25076217dcf0cfab9f090afeb9dd148bd5 Mon Sep 17 00:00:00 2001 From: Erwin Romkes <61180307+erwinromkes@users.noreply.github.com> Date: Mon, 4 Jul 2022 12:21:39 +0200 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ab092f..7e1a90f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.10.3] - 2022-07-04 +## [0.10.4] - 2022-07-04 ### Added - Add meta description from post excerpt