Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCanonical example
$this
->eventDispatcher->
dispatch
(
new
NavigationPageLoadedEvent
(
$page
,
$context
,
$request
)
)
;
if
(
$page
->
getMetaInformation
(
)
)
{
$canonical
=
(
$navigationId
===
$context
->
getSalesChannel
(
)
->
getNavigationCategoryId
(
)
)
?
$this
->seoUrlReplacer->
generate
(
'frontend.home.page'
)
:
$this
->seoUrlReplacer->
generate
(
'frontend.navigation.page',
[
'navigationId' =>
$navigationId
]
)
;
$page
->
getMetaInformation
(
)
->
setCanonical
(
$canonical
)
;
}
return
$page
;
}
private
function
loadMetaData
(
CategoryEntity
$category
, NavigationPage
$page
, SalesChannelEntity
$salesChannel
)
: void
{
$metaInformation
=
$page
->
getMetaInformation
(
)
;
if
(
$metaInformation
=== null
)
{
return
;
}