People directories, ministries, organization contacts (migrations 062 to 064)
- People tags (062): Data → People tags (Musicians seeded); a person's Directories repeater tags them and their Specialty line shows on their tile. A People directory section preset shows a tag's first 12 and links to its full page, /directory/<tag>, with page meta and a sitemap entry. Tiles' details panels show a person's links. - Ministries (063): a new organization kind. A group picks its ministry and its page says "Ministry: <name>", linked to the ministry's website. Ministries have no public page, list, sitemap or timeline entry, and aren't offered where a record links to its organization. organizations is rebuilt for the kind CHECK. - Organization contacts (064): Data → Contact types; a private Contacts repeater on each organization (editors and up, readRole on a child collection). Tools → Newsletter → Recipients filters them by type, kind, region and published and downloads a Mailchimp CSV. - A trigger refusing a save with a sentence is shown as that message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
07e56bfd20
commit
0ed7315156
38 changed files with 1108 additions and 29 deletions
|
|
@ -252,8 +252,9 @@ function eventMeta(site, db, id, meta) {
|
|||
function organizationMeta(site, db, id, kind, meta) {
|
||||
const row = db.prepare(`SELECT * FROM organizations WHERE id = ? AND is_published = 1`).get(id);
|
||||
// /regions/x must be a region: the same slug under the wrong route
|
||||
// is a page the site doesn't have.
|
||||
if (!row || (kind && row.kind !== kind)) return notFound(meta);
|
||||
// is a page the site doesn't have. A ministry has no page at all
|
||||
// (063_ministries.sql).
|
||||
if (!row || (kind && row.kind !== kind) || row.kind === "ministry") return notFound(meta);
|
||||
return {
|
||||
...meta,
|
||||
title: titled(site, row.name),
|
||||
|
|
@ -307,6 +308,17 @@ function personMeta(site, db, id, meta) {
|
|||
};
|
||||
}
|
||||
|
||||
/* A people tag's directory (062_people_tags.sql), /directory/:id. */
|
||||
function directoryMeta(site, db, id, meta) {
|
||||
const row = db.prepare(`SELECT * FROM person_tag_types WHERE id = ?`).get(id);
|
||||
if (!row) return notFound(meta);
|
||||
return {
|
||||
...meta,
|
||||
title: titled(site, row.name),
|
||||
description: plainText(row.blurb) ?? meta.description,
|
||||
};
|
||||
}
|
||||
|
||||
function blogMeta(site, db, id, meta) {
|
||||
const row = db.prepare(`SELECT * FROM blog_posts WHERE id = ? AND is_published = 1`).get(id);
|
||||
if (!row) return notFound(meta);
|
||||
|
|
@ -388,7 +400,7 @@ export function metaFor(db, rawPath) {
|
|||
return { ...meta, title: titled(site, page.title), description: plainText(page.description) ?? meta.description };
|
||||
}
|
||||
|
||||
const match = pathname.match(/^\/(events|regions|groups|partners|organizations|teams|awards|people|blog)\/([^/]+)$/);
|
||||
const match = pathname.match(/^\/(events|regions|groups|partners|organizations|teams|awards|people|blog|directory)\/([^/]+)$/);
|
||||
if (!match) return notFound(meta);
|
||||
|
||||
const [, base, rawId] = match;
|
||||
|
|
@ -418,6 +430,8 @@ export function metaFor(db, rawPath) {
|
|||
return personMeta(site, db, id, meta);
|
||||
case "blog":
|
||||
return blogMeta(site, db, id, meta);
|
||||
case "directory":
|
||||
return directoryMeta(site, db, id, meta);
|
||||
}
|
||||
return notFound(meta);
|
||||
}
|
||||
|
|
@ -522,7 +536,10 @@ export function sitemap(db) {
|
|||
.all()
|
||||
.map((r) => ({ loc: `/events/${r.id}`, lastmod: day(r.updated_at) })),
|
||||
...db
|
||||
.prepare(`SELECT id, kind, updated_at FROM organizations WHERE is_published = 1 AND is_listed = 1`)
|
||||
.prepare(
|
||||
`SELECT id, kind, updated_at FROM organizations
|
||||
WHERE is_published = 1 AND is_listed = 1 AND kind <> 'ministry'`,
|
||||
)
|
||||
.all()
|
||||
.map((r) => ({ loc: `${ORG_ROUTES[r.kind] ?? "/organizations"}/${r.id}`, lastmod: day(r.updated_at) })),
|
||||
...db
|
||||
|
|
@ -545,6 +562,10 @@ export function sitemap(db) {
|
|||
.prepare(`SELECT id, updated_at FROM blog_posts WHERE is_published = 1 AND is_listed = 1`)
|
||||
.all()
|
||||
.map((r) => ({ loc: `/blog/${r.id}`, lastmod: day(r.updated_at) })),
|
||||
...db
|
||||
.prepare(`SELECT id FROM person_tag_types`)
|
||||
.all()
|
||||
.map((r) => ({ loc: `/directory/${r.id}` })),
|
||||
];
|
||||
|
||||
const xml = entries
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue