index-main/site/config/config.php
isUnknown f757906584
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s
feat: impact-media page type with OG scraping and cache
- Add impact-media blueprint (entries field + linked investigation)
- Add minimal impact-media template
- Refactor card-open-graph snippet: accepts $url param, Kirby cache (6h TTL), decode HTML entities, empty alt on images
- Update impacts.yml to allow impact-media pages
- Render impact-media in investigation aside with dynamic count + details/summary
- Add OG cache config in config.php
- CSS formatting fixes (body, card-block-small, category)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 17:31:00 +01:00

123 lines
3.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
return [
'debug' => true,
'languages' => true,
'date.handler' => 'intl',
// 'auth' => [
// 'methods' => [
// 'password' => ['2fa' => true]
// ]
// ],
'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 7281000px, 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'],
],
// Hero cover investigation : 940px fixe ≥1000px, 90vw en dessous
'cover-hero' => [680, 940, 1200, 1880],
'cover-hero-webp' => [
'680w' => ['width' => 680, 'format' => 'webp'],
'940w' => ['width' => 940, 'format' => 'webp'],
'1200w' => ['width' => 1200, 'format' => 'webp'],
'1880w' => ['width' => 1880, 'format' => 'webp'],
],
// Body 1 colonne : 100vw
'body-full' => [750, 1000, 1440, 1880],
'body-full-webp' => [
'750w' => ['width' => 750, 'format' => 'webp'],
'1000w' => ['width' => 1000, 'format' => 'webp'],
'1440w' => ['width' => 1440, 'format' => 'webp'],
'1880w' => ['width' => 1880, 'format' => 'webp'],
],
// Body 2 colonnes : 50vw ≥768px, 90vw en dessous
'body-half' => [680, 720, 1000, 1380, 1440],
'body-half-webp' => [
'680w' => ['width' => 680, 'format' => 'webp'],
'720w' => ['width' => 720, 'format' => 'webp'],
'1000w' => ['width' => 1000, 'format' => 'webp'],
'1380w' => ['width' => 1380, 'format' => 'webp'],
'1440w' => ['width' => 1440, 'format' => 'webp'],
],
],
],
'panel' => [
'menu' => require_once __DIR__ . '/menu.php',
'css' => '/assets/css/panel.css'
],
'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',
'cache' => [
'og' => true,
],
'routes' => [
require(__DIR__ . '/routes/newsletter.php'),
],
'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);
}
}
]
];