tem/task_detail.sql

              SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
              -- not including breadcrumbs from sqlpage_aide_navigation
              -- not including page title from sqlpage_aide_navigation
              

              SELECT 'title' AS component, (SELECT COALESCE(title, caption)
    FROM sqlpage_aide_navigation
   WHERE namespace = 'prime' AND path = 'tem/task_detail.sql/index.sql') as contents;
    ;

--- Breadcrumbs
SELECT 'breadcrumb' AS component;
SELECT 'Home' AS title, sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/' AS link;
SELECT 'Tem' AS title, sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/tem/index.sql' AS link;
SELECT 
(SELECT title FROM tem_task_summary WHERE uniform_resource_id = $task_id) AS title,
'#' AS link;

--- Card Header with Task Title
SELECT 'card' AS component,
    (SELECT title
        FROM tem_task_summary
        WHERE uniform_resource_id = $task_id) AS title,
    1 AS columns;

--- Task Content Section (rendered nicely in Markdown)
WITH RECURSIVE strip_comments(txt) AS (
-- initial content (after frontmatter)
SELECT ltrim(
        substr(
        content,
        instr(substr(content, instr(content, '---') + 3), '---') + instr(content, '---') + 5
        )
    )
FROM tem_task_summary
WHERE uniform_resource_id = $task_id

UNION ALL

-- remove first <!-- ... --> occurrence
SELECT 
    substr(txt, 1, instr(txt, '<!--') - 1) || substr(txt, instr(txt, '-->') + 3)
FROM strip_comments
WHERE txt LIKE '%<!--%-->%'
)
SELECT txt AS description_md
FROM strip_comments
WHERE txt NOT LIKE '%<!--%-->%'
LIMIT 1;