Changeset 328d837 in Klonkt for src/routes/posts.js


Ignore:
Timestamp:
06/29/2026 11:24:30 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
09a2061
Parents:
93b147d
Message:

feat(music): schema.org MusicRecording/MusicAlbum structured data on audio posts (music federation Fase 1)

An audio post now emits standard schema.org MusicRecording (single track) or MusicAlbum
(album/playlist) JSON-LD alongside the existing Article data — a real web standard read by
search engines and generic JSON-LD consumers, NOT a Klonkt-invented field. The url points
to the gated player page, so the anti-steal posture is unchanged. The track-resolution helper
is the reusable base for the (future) Funkwhale Audio/Library federation (Fase 2).

  • src/services/MusicMeta.js (new) — resolves a post's track/album/playlist shortcodes to hosted tracks and builds a schema.org MusicRecording/MusicAlbum (name, byArtist=MusicGroup, inAlbum, ISO-8601 duration, license, creditText, image, url)
  • src/routes/posts.js — passes a musicLd local on the post page
  • src/views/shell.ejs — renders a second ld+json script for music posts (Article kept intact)

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r93b147d r328d837  
    1919import { toWebp } from '../services/ImageWebpService.js';
    2020import ActivityPubService from '../services/ActivityPubService.js';
     21import MusicMeta from '../services/MusicMeta.js';
    2122
    2223const __dirname = path.dirname(fileURLToPath(import.meta.url));
     
    10141015    siteAvatar,
    10151016    postHasPlayableAudio: ActivityPubService.hasPlayableAudio(post.content || '', site.id),
     1017    musicLd: MusicMeta.build((process.env.PUBLIC_BASE_URL || `${req.protocol}://${req.get('host')}`).replace(/\/+$/, ''), site, post),
    10161018    pageTitle: post.title + ' - ' + site.title,
    10171019    socialDescr: post.excerpt || '',
Note: See TracChangeset for help on using the changeset viewer.