Changeset ce8c8c2 in Klonkt for src/routes/artists.js


Ignore:
Timestamp:
06/14/2026 06:46:13 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
74c2473
Parents:
a3169f5
Message:

feat: hub-home shows main/label account separately (not under Artists)

The main site (oldest = company/main account, e.g. Studio Noord) appeared
among the artists. Now it gets a highlighted "Main page" card above the roster
and is excluded from both the Artists roster and the /artiesten directory
(a label is not an artist).

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/artists.js

    ra3169f5 rce8c8c2  
    2626  if (!Number.isFinite(page) || page < 1) page = 1;
    2727
     28  // De hoofd-/labelsite (oudste) is geen artiest -> uit de directory weren,
     29  // consistent met de hub-home die 'm apart toont.
     30  const mainRow = db.prepare('SELECT id FROM sites ORDER BY created_at ASC LIMIT 1').get();
     31  const mainId = mainRow ? mainRow.id : '';
     32
    2833  // Zoekterm tegen titel/slug/tagline (case-insensitive via LIKE; SQLite LIKE is
    2934  // standaard ongevoelig voor ASCII-hoofdletters). De ESCAPE '\' maakt %, _ en \
    3035  // in de zoekterm letterlijk (anders zouden ze als wildcards werken).
    31   const where = q
    32     ? "WHERE (s.title LIKE @like ESCAPE '\\' OR s.slug LIKE @like ESCAPE '\\' OR s.tagline LIKE @like ESCAPE '\\')"
    33     : '';
    3436  const like = '%' + q.replace(/[\\%_]/g, (m) => '\\' + m) + '%';
    35   const params = q ? { like } : {};
     37  const conds = ['s.id != @mainId'];
     38  if (q) conds.push("(s.title LIKE @like ESCAPE '\\' OR s.slug LIKE @like ESCAPE '\\' OR s.tagline LIKE @like ESCAPE '\\')");
     39  const where = 'WHERE ' + conds.join(' AND ');
     40  const params = q ? { mainId, like } : { mainId };
    3641
    3742  const total = db.prepare(`SELECT COUNT(*) AS c FROM sites s ${where}`)
Note: See TracChangeset for help on using the changeset viewer.