simonw / museums

A website recommending niche museums to visit

Home Page:https://www.niche-museums.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include press and extra photos in the Atom feed

simonw opened this issue · comments

After a huge amount of experimentation, this query seems to do the trick:

SELECT
  'tag:niche-museums.com,' || substr(m.created, 0, 11) || ':' || m.id as atom_id,
  m.name as atom_title,
  m.created as atom_updated,
  'https://www.niche-museums.com/browse/museums/' || m.id as atom_link,
  coalesce(
    '<img src="' || m.photo_url || '?w=800&amp;h=400&amp;fit=crop&amp;auto=compress">',
    ''
  ) || render_markdown(
    m.description || '

' || coalesce(
      (
        select
          group_concat(
            '* [' || json_extract(p.value, '$.title') || '](' || json_extract(p.value, '$.url') || ') ' || json_extract(p.value, '$.author') || ', ' || json_extract(p.value, '$.publication') || ', ' || json_extract(p.value, '$.date'),
            '
'
          )
        from
          json_each(coalesce(m.press, '[{}]')) as p
      ),
      ''
    )
  ) || coalesce(
    (
      select
        group_concat(
          '<p><img src="' || json_extract(ph.value, '$.url') || '?w=400&auto=compress"></p>',
          ''
        )
      from
        json_each(coalesce(m.photos, '[{}]')) as ph
    ),
    ''
  ) as atom_content_html
FROM
  museums m
order by
  m.created desc
limit
  15

Done. Here's what it looks like in Reeder on OSX:

Screenshot_12_26_19__6_19_PM