Skip to content

Commit

Permalink
Remove language meta being send via http headers fabianmichael#26
Browse files Browse the repository at this point in the history
  • Loading branch information
Daandelange committed Feb 5, 2023
1 parent ac4d00e commit 55d05c2
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions config/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,6 @@
use Kirby\Cms\Page;

return [
'route:after' => function ($result): void {
if ($result instanceof Page) {
$page = $result;

if ( $page->exists() && $page->kirby()->multilang() && $page->kirby()->languages()->count() > 1) {
$response = $page->kirby()->response();
// Add current content-language
$response->header('Content-Language', $page->kirby()->language()->code());
// Links to all content languages
$alternates = [];
foreach ($page->kirby()->languages() as $lang) {
// Only provide links for pages that have actual translation content
if ($page->translation($lang->code())->exists() === false) {
continue;
}
$alternates[$page->url($lang->code())] = '<'.$page->url($lang->code()).'>; rel="alternate"; hreflang="'.($lang->locale(LC_ALL)??$lang->code()).'"';
}
if (count($alternates)>0) {
$response->header('Link', implode(', ', $alternates));
}
}
}
},

// 'meta.load:after' => function (array $metadata, Page $page) {
// // set `thumbnail.png` as default share image for all pages,
// // if not other image was already set by a page model
Expand Down

0 comments on commit 55d05c2

Please sign in to comment.