seo : inject semantic html in kirby templates for bot indexing
All checks were successful
Deploy Production / Deploy to Production (push) Successful in 28s
All checks were successful
Deploy Production / Deploy to Production (push) Successful in 28s
Each page template now renders its content in a visually-hidden #ssr-content div (sr-only technique) so search engine crawlers see real HTML without impacting the Svelte app layout. Shared snippets handle nav, footer contact info, and article cards. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4d4832beda
commit
459fadf0a4
18 changed files with 279 additions and 0 deletions
|
|
@ -6,6 +6,19 @@
|
|||
|
||||
<?php snippet('seo/head') ?>
|
||||
|
||||
<style>
|
||||
#app { min-height: 100vh; }
|
||||
#ssr-content {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0,0,0,0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="<?= url('assets/favicon.png') ?>">
|
||||
|
||||
|
|
|
|||
9
site/snippets/ssr/article-card.php
Normal file
9
site/snippets/ssr/article-card.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<article>
|
||||
<h3><a href="<?= $article->url() ?>"><?= $article->title() ?></a></h3>
|
||||
<?php if ($article->intro()->isNotEmpty()): ?>
|
||||
<p><?= $article->intro() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($article->published()->isNotEmpty()): ?>
|
||||
<time datetime="<?= $article->published()->toDate('Y-m-d') ?>"><?= $article->published()->toDate('d/m/Y') ?></time>
|
||||
<?php endif ?>
|
||||
</article>
|
||||
11
site/snippets/ssr/footer.php
Normal file
11
site/snippets/ssr/footer.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<footer>
|
||||
<?php if ($site->contactAddress()->isNotEmpty()): ?>
|
||||
<address><?= $site->contactAddress()->nl2br()->inline() ?></address>
|
||||
<?php endif ?>
|
||||
<?php if ($site->contactEmail()->isNotEmpty()): ?>
|
||||
<a href="mailto:<?= $site->contactEmail() ?>"><?= $site->contactEmail() ?></a>
|
||||
<?php endif ?>
|
||||
<?php foreach ($site->socialLinks()->toStructure() as $social): ?>
|
||||
<a href="<?= $social->url() ?>" rel="noopener noreferrer"><?= $social->label() ?></a>
|
||||
<?php endforeach ?>
|
||||
</footer>
|
||||
13
site/snippets/ssr/nav.php
Normal file
13
site/snippets/ssr/nav.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
$homePage = $site->find('home');
|
||||
$navPages = $homePage
|
||||
? $site->pages()->listed()->prepend($homePage->id(), $homePage)
|
||||
: $site->pages()->listed();
|
||||
?>
|
||||
<nav aria-label="Navigation principale">
|
||||
<ul>
|
||||
<?php foreach ($navPages as $navPage): ?>
|
||||
<li><a href="<?= $navPage->url() ?>"<?= $navPage->is($page) ? ' aria-current="page"' : '' ?>><?= $navPage->title() ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
@ -1,2 +1,28 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->heading()->isNotEmpty() ? $page->heading() : $page->title() ?></h1>
|
||||
<?php if ($page->subtitle()->isNotEmpty()): ?>
|
||||
<p><?= $page->subtitle() ?></p>
|
||||
<?php endif ?>
|
||||
<?php foreach ($page->body()->toBlocks() as $block): ?>
|
||||
<?php if ($block->type() === 'text'): ?>
|
||||
<?= $block->content()->text()->value() ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<?php $team = $page->files()->template('member')->sort('sort') ?>
|
||||
<?php if ($team->isNotEmpty()): ?>
|
||||
<ul>
|
||||
<?php foreach ($team as $member): ?>
|
||||
<li>
|
||||
<strong><?= $member->memberName() ?></strong>
|
||||
<?php if ($member->role()->isNotEmpty()): ?> — <?= $member->role() ?><?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
</main>
|
||||
<?php snippet('ssr/footer') ?>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,35 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php if ($page->intro()->isNotEmpty()): ?>
|
||||
<p><?= $page->intro() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($page->published()->isNotEmpty()): ?>
|
||||
<time datetime="<?= $page->published()->toDate('Y-m-d') ?>"><?= $page->published()->toDate('d/m/Y') ?></time>
|
||||
<?php endif ?>
|
||||
<?php foreach ($page->body()->toBlocks() as $block): ?>
|
||||
<?php if ($block->type() === 'text'): ?>
|
||||
<?= $block->content()->text()->value() ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<?php
|
||||
$related = $page->relatedArticles()->toPages();
|
||||
if ($related->isEmpty()) {
|
||||
$related = $page->siblings()->listed()->not($page)->shuffle()->limit(3);
|
||||
}
|
||||
?>
|
||||
<?php if ($related->isNotEmpty()): ?>
|
||||
<section>
|
||||
<h2>Articles liés</h2>
|
||||
<ul>
|
||||
<?php foreach ($related as $rel): ?>
|
||||
<li><?php snippet('ssr/article-card', ['article' => $rel]) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endif ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,17 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php if ($page->intro()->isNotEmpty()): ?>
|
||||
<p><?= $page->intro() ?></p>
|
||||
<?php endif ?>
|
||||
<ul>
|
||||
<?php foreach ($page->children()->listed()->sortBy('date', 'desc') as $article): ?>
|
||||
<li><?php snippet('ssr/article-card', ['article' => $article]) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</main>
|
||||
<?php snippet('ssr/footer') ?>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,13 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php foreach ($page->body()->toBlocks() as $block): ?>
|
||||
<?php if ($block->type() === 'text'): ?>
|
||||
<?= $block->content()->text()->value() ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,13 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->writer()->isNotEmpty() ? $page->writer()->inline() : $page->title() ?></h1>
|
||||
<?php foreach ($page->body()->toBlocks() as $block): ?>
|
||||
<?php if ($block->type() === 'text'): ?>
|
||||
<?= $block->content()->text()->value() ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,11 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php if ($page->description()->isNotEmpty()): ?>
|
||||
<p><?= $page->description() ?></p>
|
||||
<?php endif ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,14 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $site->siteTitle() ?></h1>
|
||||
<?php if ($page->subtitle()->isNotEmpty()): ?>
|
||||
<p><?= $page->subtitle()->inline() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($page->ctaText()->isNotEmpty()): ?>
|
||||
<a href="<?= $page->ctaLink()->toPage()?->url() ?>"><?= $page->ctaText() ?></a>
|
||||
<?php endif ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,18 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<ul>
|
||||
<?php foreach ($page->children()->listed() as $game): ?>
|
||||
<li>
|
||||
<h2><a href="<?= $game->url() ?>"><?= $game->title() ?></a></h2>
|
||||
<?php if ($game->description()->isNotEmpty()): ?>
|
||||
<p><?= $game->description() ?></p>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,14 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php foreach ($page->body()->toBlocks() as $block): ?>
|
||||
<?php if ($block->type() === 'text'): ?>
|
||||
<?= $block->content()->text()->value() ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</main>
|
||||
<?php snippet('ssr/footer') ?>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,21 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<ul>
|
||||
<?php foreach ($page->children()->listed() as $project): ?>
|
||||
<li>
|
||||
<h2><a href="<?= $project->url() ?>"><?= $project->title() ?></a></h2>
|
||||
<?php if ($project->catchPhrase()->isNotEmpty()): ?>
|
||||
<p><?= $project->catchPhrase() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($project->description()->isNotEmpty()): ?>
|
||||
<p><?= $project->description() ?></p>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,14 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php foreach ($page->body()->toBlocks() as $block): ?>
|
||||
<?php if ($block->type() === 'text'): ?>
|
||||
<?= $block->content()->text()->value() ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</main>
|
||||
<?php snippet('ssr/footer') ?>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,24 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php if ($page->tagline()->isNotEmpty()): ?>
|
||||
<p><?= $page->tagline() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($page->description()->isNotEmpty()): ?>
|
||||
<div><?= $page->description()->kt() ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($page->category()->isNotEmpty()): ?>
|
||||
<p><?= $page->category() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($page->platforms()->isNotEmpty()): ?>
|
||||
<ul>
|
||||
<?php foreach ($page->platforms()->split(',') as $platform): ?>
|
||||
<li><?= trim($platform) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,14 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php if ($page->intro()->isNotEmpty()): ?>
|
||||
<p><?= $page->intro() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($page->published()->isNotEmpty()): ?>
|
||||
<time datetime="<?= $page->published()->toDate('Y-m-d') ?>"><?= $page->published()->toDate('d/m/Y') ?></time>
|
||||
<?php endif ?>
|
||||
</main>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,25 @@
|
|||
<?php snippet('header') ?>
|
||||
<div id="ssr-content">
|
||||
<?php snippet('ssr/nav') ?>
|
||||
<main>
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<?php if ($page->intro()->isNotEmpty()): ?>
|
||||
<p><?= $page->intro() ?></p>
|
||||
<?php endif ?>
|
||||
<ul>
|
||||
<?php foreach ($page->children()->listed()->sortBy('published', 'desc') as $item): ?>
|
||||
<li>
|
||||
<h2><a href="<?= $item->url() ?>"><?= $item->title() ?></a></h2>
|
||||
<?php if ($item->intro()->isNotEmpty()): ?>
|
||||
<p><?= $item->intro() ?></p>
|
||||
<?php endif ?>
|
||||
<?php if ($item->published()->isNotEmpty()): ?>
|
||||
<time datetime="<?= $item->published()->toDate('Y-m-d') ?>"><?= $item->published()->toDate('d/m/Y') ?></time>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</main>
|
||||
<?php snippet('ssr/footer') ?>
|
||||
</div>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue