Skip to content

Commit 320386e

Browse files
committed
add canonical meta tag
1 parent 009d2f1 commit 320386e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

templates/layout/default.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$cakeDescription = 'CakePHP Plugins';
1818
$request = $this->getRequest();
19+
$canonicalUrl = $this->Url->build($request->getPath() ?: '/', ['fullBase' => true]);
1920
$isPackagesIndex = $request->getParam('controller') === 'Packages' && $request->getParam('action') === 'index';
2021
$searchValue = (string)$request->getQuery('search', '');
2122
$cakephpSlugs = (array)$request->getQuery('cakephp_slugs', []);
@@ -31,6 +32,7 @@
3132
<?= $this->fetch('title') ?>
3233
</title>
3334
<?= $this->Html->meta('icon') ?>
35+
<link rel="canonical" href="<?= h($canonicalUrl) ?>">
3436

3537
<?= $this->Html->css(['cake']) ?>
3638

0 commit comments

Comments
 (0)