feat: intégration plugin Kirby SEO
All checks were successful
Deploy / Deploy to Production (push) Successful in 22s
All checks were successful
Deploy / Deploy to Production (push) Successful in 22s
- Ajout de tobimori/kirby-seo via Composer
- snippet('seo/head') dans header.php (remplace les meta manuels)
- snippet('seo/schemas') dans footer.php pour JSON-LD
- Onglet SEO ajouté dans site.yml et tous les blueprints de pages
- Configuration SEO dans config.php (sitemap, robots, canonicalBase TODO)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
baab2fb3a1
commit
58c31ea391
133 changed files with 9201 additions and 253 deletions
77
site/plugins/kirby-seo/docs/2_customization/05_sitemap.md
Normal file
77
site/plugins/kirby-seo/docs/2_customization/05_sitemap.md
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
---
|
||||
title: Customizing the Sitemap
|
||||
intro: Fine-tune the built-in sitemap or replace it entirely
|
||||
---
|
||||
|
||||
The built-in sitemap generator has a few options to adjust its behavior. For most sites, these are enough. If you need full control, you can replace the generator with your own.
|
||||
|
||||
## Excluding templates
|
||||
|
||||
By default, only the `error` template is excluded. To exclude more templates:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// site/config/config.php
|
||||
|
||||
return [
|
||||
'tobimori.seo' => [
|
||||
'sitemap' => [
|
||||
'excludeTemplates' => ['error', 'redirect', 'internal'],
|
||||
],
|
||||
],
|
||||
];
|
||||
```
|
||||
|
||||
## Grouping by template
|
||||
|
||||
By default, all pages end up in a single sitemap. If you have many pages, you can split them into separate sitemaps per template. This creates a sitemap index at `/sitemap.xml` with links to `/sitemap-blog.xml`, `/sitemap-product.xml`, etc.
|
||||
|
||||
```php
|
||||
'sitemap' => [
|
||||
'groupByTemplate' => true,
|
||||
],
|
||||
```
|
||||
|
||||
## Change frequency and priority
|
||||
|
||||
Both `changefreq` and `priority` accept a static value or a callable:
|
||||
|
||||
```php
|
||||
'sitemap' => [
|
||||
'changefreq' => 'daily',
|
||||
'priority' => fn (Page $page) => $page->isHomePage() ? 1.0 : 0.5,
|
||||
],
|
||||
```
|
||||
|
||||
The default `changefreq` is `weekly`. The default `priority` is calculated from page depth: the homepage gets `1.0`, each level deeper subtracts `0.2`, down to `0.2`.
|
||||
|
||||
## Writing your own generator
|
||||
|
||||
If the options above aren't enough, you can replace the entire sitemap generator. The `generator` option takes a callable that receives a `SitemapIndex` instance. Here's a minimal example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use tobimori\Seo\Sitemap\SitemapIndex;
|
||||
|
||||
return [
|
||||
'tobimori.seo' => [
|
||||
'sitemap' => [
|
||||
'generator' => function (SitemapIndex $sitemap) {
|
||||
$index = $sitemap->create('pages');
|
||||
|
||||
foreach (site()->index()->listed() as $page) {
|
||||
$index->createUrl($page->url())
|
||||
->lastmod($page->modified())
|
||||
->changefreq('weekly')
|
||||
->priority(0.8);
|
||||
}
|
||||
},
|
||||
],
|
||||
],
|
||||
];
|
||||
```
|
||||
|
||||
`$sitemap->create('key')` creates a sitemap group. `$index->createUrl($url)` adds a URL entry, and you can chain `->lastmod()`, `->changefreq()`, `->priority()`, and `->alternates()` on it.
|
||||
|
||||
The built-in generator does more: it filters by robots settings, respects `excludeTemplates`, handles `groupByTemplate`, and adds hreflang links for multilingual sites. You can find its source in `config/options/sitemap.php` as a reference for your own.
|
||||
Loading…
Add table
Add a link
Reference in a new issue