- Add `cover-card` and `cover-card-webp` srcsets in config Widths [465, 728, 930, 1000, 1456] couvrent 1x et 2x (retina) pour les 3 breakpoints : ≥1000px fixe 465px, 728–1000px 50vw, <728px 100vw - Refactor snippet picture.php : accepte $sizes (string complète), $srcsetName (srcset nommé), $alt (override), fallback webp automatique - Update investigations.php : remplace <img> nu par snippet picture avec sizes et srcsetName adaptés Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
84 lines
No EOL
2.5 KiB
PHP
84 lines
No EOL
2.5 KiB
PHP
<?php
|
||
|
||
return [
|
||
'debug' => true,
|
||
'languages' => true,
|
||
'date.handler' => 'intl',
|
||
'thumbs' => [
|
||
'quality' => 80,
|
||
'presets' => [
|
||
'grid' => 400,
|
||
'default' => [
|
||
'width' => 1024, 'format' => 'webp'
|
||
],
|
||
'full' => 2048,
|
||
'format' => 'webp'
|
||
],
|
||
'srcsets' => [
|
||
'default' => [200, 400, 600, 800, 1024, 1440, 2048],
|
||
'webp' => [
|
||
'300w' => ['width' => 300, 'format' => 'webp'],
|
||
'600w' => ['width' => 600, 'format' => 'webp'],
|
||
'900w' => ['width' => 900, 'format' => 'webp'],
|
||
'1200w' => ['width' => 1200, 'format' => 'webp'],
|
||
],
|
||
// Cover cards investigations : 465px fixe ≥1000px, 50vw 728–1000px, 100vw <728px
|
||
// Widths couvrent 1x et 2x (retina) pour chaque breakpoint
|
||
'cover-card' => [465, 728, 930, 1000, 1456],
|
||
'cover-card-webp' => [
|
||
'465w' => ['width' => 465, 'format' => 'webp'],
|
||
'728w' => ['width' => 728, 'format' => 'webp'],
|
||
'930w' => ['width' => 930, 'format' => 'webp'],
|
||
'1000w' => ['width' => 1000, 'format' => 'webp'],
|
||
'1456w' => ['width' => 1456, 'format' => 'webp'],
|
||
],
|
||
],
|
||
],
|
||
'panel' => [
|
||
'menu' => require_once __DIR__ . '/menu.php'
|
||
],
|
||
'donorbox' => [
|
||
'api_key' => '', // À remplir avec la clé API Donorbox
|
||
'campaign_slug' => 'soutenir-index-en-2024',
|
||
'campaign_url' => 'https://donorbox.org/soutenir-index-en-2024',
|
||
'api_base_url' => 'https://donorbox.org/api/v1'
|
||
],
|
||
'tobimori.seo.canonicalBase' => 'https://www.index.ngo',
|
||
|
||
'hooks' => [
|
||
'page.update:after' => function ($newPage) {
|
||
if ($newPage->intendedTemplate()->name() !== 'investigation') {
|
||
return;
|
||
}
|
||
|
||
$database = page('database');
|
||
if (!$database) {
|
||
return;
|
||
}
|
||
|
||
$fields = [
|
||
'keywords' => 'keywords',
|
||
'incidentCountry' => 'countries',
|
||
];
|
||
|
||
$updated = false;
|
||
$data = [];
|
||
|
||
foreach ($fields as $investigationField => $dbField) {
|
||
$newValues = $newPage->content()->get($investigationField)->split();
|
||
$existingValues = $database->content()->get($dbField)->split();
|
||
$merged = array_unique(array_merge($existingValues, $newValues));
|
||
|
||
if (count($merged) > count($existingValues)) {
|
||
$data[$dbField] = implode(', ', $merged);
|
||
$updated = true;
|
||
}
|
||
}
|
||
|
||
if ($updated) {
|
||
kirby()->impersonate('kirby');
|
||
$database->update($data);
|
||
}
|
||
}
|
||
]
|
||
]; |