Changeset 328d837 in Klonkt


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@…>

Location:
src
Files:
1 added
2 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 || '',
  • src/views/shell.ejs

    r93b147d r328d837  
    199199<script type="application/ld+json"><%- JSON.stringify(_jsonLd) %></script>
    200200<% } %>
     201<% if (typeof musicLd !== 'undefined' && musicLd) { %>
     202<%# Music posts also carry standard schema.org MusicRecording/MusicAlbum data (Phase 1 of
     203    music federation): real web standard, read by search engines + generic consumers. %>
     204<script type="application/ld+json"><%- JSON.stringify(musicLd) %></script>
     205<% } %>
    201206
    202207<!-- Self-hosted fonts (privacy-first) -->
Note: See TracChangeset for help on using the changeset viewer.