You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a table involving a playlist with audio control for each title
What is your problem ? A description of the problem, not the solution you are proposing.
it is not possible to introduce a audio tag in the table (or you have to unlock html_safe and it is not a good practice)
Describe the solution you'd like
add an option "audio" directly in the template "table"
Describe alternatives you've considered
I have developed a custom table.audio.handlebars which works by modifying : {{~#if (array_contains_case_insensitive ../../markdown @key)~}} {{{markdown this}}} {{~else~}} {{~#if (array_contains_case_insensitive ../../icon @key)~}} {{~icon_img this~}} {{~else~}} {{this}} {{~/if~}} {{~/if~}}
and in my website
`
SELECT 'table_audio' AS component,
'Liste des poèmes' AS title,
'/z_advent/poems/poem_edit_4.sql?poem_id={id}' AS edit_url,
'/z_advent/poems/poem_delete_0.sql?poem_id={id}' AS delete_url,
'Titre' AS markdown,
'Audio' AS audio,
TRUE AS sort,
TRUE AS search;
SELECT
p.poem_id AS _sqlpage_id,
p.poem_id AS "N°",
'[' || p.poem_title || '](/z_advent/poems/poem_display_4.sql?poem_id=' || p.poem_id || ')' AS "Titre",
p.poem_author AS "Auteur",
p.poem_day AS "Jour",
p.poem_music AS "Audio"
FROM advent_poems AS p
ORDER BY p.poem_day;`
it works :
Additional context
Add any other context or screenshots about the feature request here.
I think audio in particular is too niche to be worth maintaining a new attribute in the table component. But I would love to allow writing custom html. And even better, it would be nice if across components, users could write custom html safely.
I understand your point of view ; a custom template is quiet easy to set up for those who are dealing with audio databases, so there is no emergency to introduce a new attribute.
In the next version of sqlpage you'll be able to do this:
SELECT'table'AS component, 'Audio'AS embed,
TRUE AS sort, TRUE AS search;
SELECTp.poem_titleAS"Titre",
p.poem_authorAS"Auteur",
CASE WHEN NULLIF(p.poem_music, '') IS NOT NULL
THEN 'poem_audio.sql?poem_id='||p.poem_id
END AS"Audio"FROM advent_poems AS p
ORDER BYp.poem_day;
SELECT'poem_audio'AS component, p.poem_musicAS src
FROM advent_poems AS p
WHEREp.poem_id= CAST($poem_id ASINTEGER)
AND NULLIF(p.poem_music, '') IS NOT NULL;
Activity
lovasoa commentedon Nov 27, 2026
I think audio in particular is too niche to be worth maintaining a new attribute in the table component. But I would love to allow writing custom html. And even better, it would be nice if across components, users could write custom html safely.
SebastiendOrnano commentedon Nov 27, 2026
I understand your point of view ; a custom template is quiet easy to set up for those who are dealing with audio databases, so there is no emergency to introduce a new attribute.
lovasoa commentedon Nov 27, 2026
What I would love being able to do, is have something as clean as this in the sql.
You would also write a small
audio_player.handlebarsfile that would contain the html. And you could use it anywhere, including in other components.Internally, this requires us to be able to detect the provenance of attributes in components to escape them conditionally.
I think it would unlock many new possibilities.
@81reap, what do you think ?
lovasoa commentedon Nov 27, 2026
I opened an RFC in #1642
lovasoa commentedon Nov 27, 2026
What we can do in the short term is allow embeds like we do in the card component in the table component.
lovasoa commentedon Nov 27, 2026
In the next version of sqlpage you'll be able to do this:
Not as clean as
sqlpage.componentbut I think we need some feedback before we implement that.