Skip to content

Commit

Permalink
fix: breadcrumb-generation handles non-Page elements correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mleutenegger committed Aug 7, 2024
1 parent 012eea8 commit 917ca61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Extensions/SEOExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ public function getBreadcrumbListSchema(SiteTree $page)
$baseURL = Director::absoluteBaseURL();
$currentURL = $owner->AbsoluteLink();
$breadCrumbs = [];
if (!$owner->isHomePage() && $homePage = SiteTree::get_by_link(null)) {
$pagedummy = $page;
if ($owner instanceof SiteTree) {
$pagedummy = $owner;
}
if (!$pagedummy->isHomePage() && $homePage = SiteTree::get_by_link(null)) {
$breadCrumbs[] = [
"@type" => "ListItem",
"name" => $homePage->getSEOTitle(),
Expand Down

0 comments on commit 917ca61

Please sign in to comment.