Files
captoys/potluck/src/components/CiteLink.astro
T
dckc fd7fd5728d capsite/potluck: a weekly zine of issues, not a blog
- issues collection (ISO-week slug, week, dek, rich-text body); home,
  /issues, and /issues/<week> pages; seed/issues.json holds three
  sketched issues (W38-W40) from public diigo bookmarks, editorial
  lines marked (draft); issues-sketch.md is the dry run behind them
- microformats: h-feed of h-entry lists; an issue is an h-entry
  (p-name, dt-published, p-summary, e-content); off-site links render
  as h-cite, /tag/<tag> links as rel-tag p-category (CiteLink.astro)
- diigo tags: shown on each bookmark and attached to issues via the
  tag taxonomy (now posts + issues); /tag/<tag> lists issues
- demo blog content gone: posts dropped from the seed, home page lists
  issues, site title/tagline, footer About widget, and About page
  rewritten; nav is Home / About / Issues; search and RSS cover issues
- .column container gives potluck's pages the header's margins

Generated-by: Claude Opus 5.5
2026-10-07 20:31:54 -05:00

44 lines
1.1 KiB
Plaintext

---
/**
* Portable Text link mark for issue bodies: an off-site link is a citation,
* marked up as an `h-cite` (name + url) so microformats parsers see each
* bookmark; a `/tag/<tag>` link is a rel-tag `p-category` of the issue
* (the `#` is CSS, so the category value is the bare tag); other on-site
* and anchor links stay plain.
*
* @see https://microformats.org/wiki/h-cite
* @see https://microformats.org/wiki/rel-tag
*/
export interface Props {
node: { markDef: { _type: "link"; _key: string; href: string; blank?: boolean } };
}
const href = Astro.props.node?.markDef?.href ?? "";
// only these schemes become hrefs (the stored href is editor input)
const safe = /^(https?:|mailto:|\/|#)/i.test(href) ? href : "";
const offSite = /^https?:/i.test(safe);
const isTag = safe.startsWith("/tag/");
---
{
offSite ? (
<cite class="h-cite"><a class="u-url p-name" href={safe}><slot /></a></cite>
) : isTag ? (
<a rel="tag" class="p-category" href={safe}><slot /></a>
) : (
<a href={safe || undefined}><slot /></a>
)
}
<style>
cite {
font-style: normal;
}
a[rel="tag"] {
font-size: 90%;
}
a[rel="tag"]::before {
content: "#";
}
</style>