fix(oembed.sql): surface correct open graph images
This commit is contained in:
parent
3dac23b171
commit
53e453ba04
6 changed files with 24 additions and 44 deletions
|
@ -96,7 +96,18 @@ SELECT
|
|||
LEFT JOIN posts p ON pg.posts_id = p.id
|
||||
LEFT JOIN directus_files df_post ON p.image = df_post.id
|
||||
WHERE pg.genres_id = g.id
|
||||
) AS posts
|
||||
) AS posts,
|
||||
json_build_object(
|
||||
'open_graph_image', (
|
||||
SELECT CONCAT('/', df_artist.filename_disk)
|
||||
FROM artists a
|
||||
LEFT JOIN directus_files df_artist ON a.art = df_artist.id
|
||||
WHERE a.genres = g.id
|
||||
AND df_artist.filename_disk IS NOT NULL AND df_artist.filename_disk != ''
|
||||
ORDER BY a.total_plays DESC
|
||||
LIMIT 1
|
||||
)
|
||||
) AS metadata
|
||||
FROM genres g
|
||||
CROSS JOIN optimized_globals globals
|
||||
ORDER BY g.id ASC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue