Fix article links and include full content in PHP feeds
Two bugs found by testing real links from the feed: - Link format was wrong (?news=<internal-id>), landing on the general listing instead of the article. Traced the real network call the site makes when opening an item and found the actual pattern: /actualites/<slug>?u=<UID> (agenda: /agenda/<slug>?u=<UID>), where the JS router reads the `u` query param to fetch @results?UID=...&fullobjects=1. - Description only used the short teaser (description_fr) even though the API response already includes the full rich-text body (text_fr.data) and attachments (items[].file.download) in the same call — no extra request needed, just wasn't being used. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+7
-5
@@ -51,13 +51,15 @@ function build_events_feed(): string
|
||||
$items = [];
|
||||
foreach (fetch_all_events() as $item) {
|
||||
$id = basename(rtrim($item['@id'] ?? '', '/'));
|
||||
$summary = strip_html($item['description_fr'] ?? $item['description'] ?? null);
|
||||
$title = $item['title_fr'] ?? $item['title'] ?? '(sans titre)';
|
||||
$uid = $item['UID'] ?? $id;
|
||||
$meta = format_event_meta($item);
|
||||
$description = implode(' | ', array_filter([$meta, $summary]));
|
||||
$description = ($meta !== '' ? '<p>' . htmlspecialchars($meta, ENT_QUOTES, 'UTF-8') . '</p>' : '')
|
||||
. full_body_html($item);
|
||||
$items[] = [
|
||||
'title' => $item['title_fr'] ?? $item['title'] ?? '(sans titre)',
|
||||
'link' => SITE . '/agenda?event=' . rawurlencode($id),
|
||||
'guid' => $item['UID'] ?? $id,
|
||||
'title' => $title,
|
||||
'link' => SITE . '/agenda/' . slugify($title) . '?u=' . rawurlencode($uid),
|
||||
'guid' => $uid,
|
||||
'pubDate' => $item['created'] ?? $item['start'] ?? null,
|
||||
'description' => $description,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user