Skip to content

Commit

Permalink
Merge pull request #91 from mooore-digital/add-description
Browse files Browse the repository at this point in the history
Add description for page
  • Loading branch information
erwinromkes authored Jul 4, 2022
2 parents d436ba4 + 54cf5e2 commit 51c0dcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.4] - 2022-07-04
### Added
- Add meta description from post excerpt

## [0.10.3] - 2022-06-29
### Fixed
- **Possible breaking change** unwanted removal of page title for blog pages
Expand Down
6 changes: 6 additions & 0 deletions Controller/Blog/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 51c0dcb

Please sign in to comment.