Files
unique/src/layouts/BaseLayout.astro
T
rzen 86ea4c8873 site: feeds everywhere + programmatic surface
Feeds: JSON Feed 1.1 at /feed.json, per-category and per-tag RSS at
/categories/<name>/rss.xml and /tags/<name>/rss.xml alongside the main
/rss.xml — all from a shared src/lib/feed.ts item source. Category/tag
pages advertise their scoped feed via autodiscovery; new /feeds/
directory page (footer-linked) lists every feed with counts; RSS feeds
gain an atom:link self reference and a feed.xsl stylesheet so they
render readably in browsers.

Programmatic readers: build-generated /llms.txt (site map with every
review/bundle/post), SearchAction on the WebSite JSON-LD wired to
/search/?q=, and a "For robots" section on /feeds/ documenting
search.json, llms.txt, the sitemap, and JSON-LD coverage.

Claude-Session: https://claude.ai/code/session_01WZaczDJjL3xZ3u5spsN5AL
2026-07-12 17:56:55 -04:00

559 lines
17 KiB
Plaintext

---
import { getSiteStats } from '../lib/entries';
import SEO from '../components/SEO.astro';
import EditConfirm from '../components/EditConfirm.astro';
import type { OgImage } from '../components/SEO.astro';
interface Props {
title: string;
description?: string;
subheader?: string;
subheaderSubtitle?: string;
subheaderVariant?: 'tagline' | 'headline';
lastUpdated?: Date;
canonicalPath?: string;
canonicalOverride?: string;
ogType?: 'website' | 'article';
ogImage?: OgImage;
noindex?: boolean;
publishedTime?: Date;
modifiedTime?: Date;
articleTags?: string[];
jsonLd?: Record<string, unknown> | Record<string, unknown>[];
/** Page-scoped feeds (category/tag) advertised alongside the site-wide ones. */
feeds?: Array<{ title: string; href: string }>;
/** Opt into the wider content tier on roomy viewports (grid/listing pages). */
wide?: boolean;
}
const {
title,
description = 'A small log of delightful, unique things — products, apps, phenomena, oddities.',
subheader,
subheaderSubtitle,
subheaderVariant = 'tagline',
lastUpdated,
canonicalPath,
canonicalOverride,
ogType,
ogImage,
noindex,
publishedTime,
modifiedTime,
articleTags,
jsonLd,
feeds,
wide,
} = Astro.props;
const siteName = 'Unique';
const SITE_FOUNDED = new Date(2026, 4, 3);
const stats = await getSiteStats();
const fmtLong = new Intl.DateTimeFormat('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
timeZone: 'UTC',
});
const fmtShort = new Intl.DateTimeFormat('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
});
const updatedDate = lastUpdated ?? stats.lastUpdated;
const year = new Date().getFullYear();
---
<!doctype html>
<html lang="en">
<head>
<SEO
title={title}
description={description}
canonicalPath={canonicalPath}
canonicalOverride={canonicalOverride}
ogType={ogType}
ogImage={ogImage}
noindex={noindex}
publishedTime={publishedTime}
modifiedTime={modifiedTime}
articleTags={articleTags}
jsonLd={jsonLd}
feeds={feeds}
/>
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "fc978456945c49ae90a0b7e0b891ffd2"}'></script>
</head>
<body class:list={[{ wide }]}>
<header class="masthead">
<div class="masthead-row">
<div class="masthead-stats">
<span><a href="/posts/2026-05-03-why-this-exists/">founded {fmtShort.format(SITE_FOUNDED)}</a></span>
</div>
<a href="/" class="masthead-brand">{siteName}</a>
<nav class="masthead-nav" aria-label="Primary">
<a href="/about/">About</a>
<a href="/blog/">Blog</a>
<a href="/search/">Search</a>
</nav>
</div>
{subheader && (
<div class="subheader">
<p class={`subheader-line${subheaderVariant === 'headline' ? ' subheader-headline' : ''}`}>{subheader}</p>
{subheaderSubtitle && subheaderVariant === 'headline' && (
<p class="subheader-subtitle">{subheaderSubtitle}</p>
)}
{updatedDate && subheaderVariant === 'headline' && (
<p class="subheader-date">
<time datetime={updatedDate.toISOString()}>{fmtLong.format(updatedDate)}</time>
</p>
)}
{updatedDate && subheaderVariant !== 'headline' && (
<p class="subheader-date">
Updated <time datetime={updatedDate.toISOString()}>{fmtLong.format(updatedDate)}</time>
</p>
)}
</div>
)}
</header>
<main>
<slot />
</main>
<footer class="site-footer">
<div class="site-footer-cols">
<section>
<h4>Browse</h4>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/grid/">Grid</a></li>
<li><a href="/sources/">Sources</a></li>
<li><a href="/feeds/">Feeds</a></li>
</ul>
</section>
<section>
<h4>Collections</h4>
<ul>
<li><a href="/grid/">Reviews</a></li>
<li><a href="/find/">Finds</a></li>
<li><a href="/bundles/">Bundles</a></li>
<li><a href="/blog/">Posts</a></li>
</ul>
</section>
<section>
<h4>About</h4>
<ul>
<li><a href="/about/">About</a></li>
<li><a href="/blog/">Blog</a></li>
<li><a href="https://stoop.rzen.dev/unique">Feedback</a></li>
</ul>
</section>
</div>
<div class="site-footer-legal">
<p>
© {year} Unique
<span aria-hidden="true">·</span>
<a href="/legal/">Legal</a>
</p>
</div>
</footer>
<style is:global>
:root {
color-scheme: light;
--fg: #1a1a1a;
--bg: #f4f0ec;
--card-fill: #ebe6df;
--muted: #6b6b6b;
--accent: #b34700;
--rule: #e0dbd2;
/* Content column width. Reading pages keep this tight for a comfortable
line length; grid/listing pages opt into the wider container via
<body class="wide"> (BaseLayout `wide` prop), which gives the masonry
4 columns instead of 3 (Masonry.astro mirrors the 69rem breakpoint).
55.5rem = 4·225px cards + 3·18px gaps + 2·22.5px body padding. */
--max: 42rem;
}
@media (min-width: 69rem) { body.wide { --max: 55.5rem; } }
* { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
background: var(--bg);
color: var(--fg);
font-family: ui-serif, Georgia, 'Iowan Old Style', 'Apple Garamond', 'Palatino Linotype', serif;
font-size: 18px;
line-height: 1.55;
-webkit-font-smoothing: antialiased;
}
body {
max-width: var(--max);
margin: 0 auto;
padding: 1.5rem 1.25rem 2rem;
}
a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { text-decoration: underline; }
/* Cross-document view transitions — a soft cross-fade between pages in
browsers that support it; everyone else just navigates. */
@view-transition { navigation: auto; }
::selection { background: color-mix(in srgb, var(--accent) 24%, var(--bg)); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html { scroll-behavior: smooth; }
/* Media fade-in: the script at the foot of <body> tags not-yet-loaded
images/videos with .fx-fade and flips .fx-in when each finishes, so
media eases in instead of popping. Cached media never gets the class
(no flash on repeat views); without JS nothing is ever hidden. */
.fx-fade { opacity: 0; }
.fx-fade.fx-in { opacity: 1; transition: opacity 0.55s ease; }
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
@view-transition { navigation: none; }
*, *::before, *::after {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}
/* Masthead */
.masthead {
margin-bottom: 2rem;
border-top: 1px solid var(--rule);
border-bottom: 1px solid var(--rule);
}
.masthead-row {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 1.5rem;
padding: 1.1rem 0;
}
.masthead-stats {
display: flex;
flex-direction: column;
gap: 0.15rem;
font-family: ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--muted);
}
.masthead-stats a { color: var(--muted); }
.masthead-stats a:hover { color: var(--accent); }
.masthead-brand {
font-family: ui-serif, Georgia, 'Iowan Old Style', 'Apple Garamond', 'Palatino Linotype', serif;
font-weight: 700;
font-size: clamp(2.4rem, 6vw, 4rem);
line-height: 1;
letter-spacing: -0.02em;
color: var(--fg);
text-align: center;
white-space: nowrap;
}
.masthead-brand:hover { text-decoration: none; color: var(--accent); }
.masthead-nav {
justify-self: end;
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 0.15rem;
font-family: ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
font-size: 0.78rem;
text-transform: uppercase;
letter-spacing: 0.08em;
}
.masthead-nav a { color: var(--muted); }
.masthead-nav a:hover { color: var(--accent); }
.subheader {
text-align: center;
padding: 0.85rem 0 1rem;
border-top: 1px solid var(--rule);
}
.subheader-line {
margin: 0;
font-style: italic;
font-size: 1rem;
color: var(--fg);
}
.subheader-line.subheader-headline {
font-family: ui-serif, Georgia, 'Iowan Old Style', 'Apple Garamond', 'Palatino Linotype', serif;
font-style: normal;
font-weight: 700;
font-size: clamp(1.6rem, 4.2vw, 2.4rem);
line-height: 1.15;
letter-spacing: -0.01em;
color: var(--fg);
}
.subheader-subtitle {
margin: 0.35rem 0 0;
font-family: ui-serif, Georgia, 'Iowan Old Style', 'Apple Garamond', 'Palatino Linotype', serif;
font-style: italic;
font-size: 1.05rem;
line-height: 1.4;
color: var(--muted);
}
.subheader-date {
margin: 0.25rem 0 0;
font-family: ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--muted);
}
@media (max-width: 640px) {
.masthead-row {
grid-template-columns: 1fr;
gap: 0.6rem;
padding: 1rem 0;
text-align: center;
}
.masthead-stats {
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem;
order: 2;
}
.masthead-brand { order: 1; }
.masthead-nav {
justify-self: center;
align-items: center;
order: 3;
}
}
main { min-height: 60vh; }
/* Site footer */
.site-footer {
margin-top: 4rem;
padding-top: 1.5rem;
border-top: 1px solid var(--rule);
color: var(--muted);
font-size: 0.85rem;
}
.site-footer-cols {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 2.5rem;
margin-bottom: 1.5rem;
text-align: center;
}
.site-footer-cols section {
min-width: 7rem;
}
.site-footer ul { align-items: center; }
.site-footer h4 {
margin: 0 0 0.5rem;
font-family: ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--fg);
font-weight: 700;
}
.site-footer ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.site-footer ul a { color: var(--muted); }
.site-footer ul a:hover { color: var(--accent); }
.site-footer-legal {
padding-top: 1rem;
border-top: 1px solid var(--rule);
text-align: center;
}
.site-footer-legal p { margin: 0; }
.site-footer-legal a { color: var(--muted); }
.site-footer-legal a:hover { color: var(--accent); }
.site-footer-legal span { margin: 0 0.4rem; }
h1, h2, h3 {
font-family: ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
letter-spacing: -0.015em;
line-height: 1.2;
}
h1 { font-size: 1.85rem; margin: 0 0 0.5rem; }
code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.9em;
background: var(--rule);
padding: 0.1em 0.35em;
border-radius: 3px;
}
pre {
background: var(--rule);
padding: 1rem;
border-radius: 6px;
overflow-x: auto;
}
pre code { background: none; padding: 0; }
blockquote {
margin: 1.25rem 0;
padding-left: 1rem;
border-left: 3px solid var(--rule);
color: var(--muted);
font-style: italic;
}
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
/* External CTA — primary "go to source" link on /reviews/ and /find/.
Sits in the body region below the write-up, not in the colophon. */
.external {
margin: 1.5rem 0 0;
font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}
.external a {
display: inline-block;
padding: 0.5rem 1rem;
background: var(--accent);
color: var(--bg);
border-radius: 6px;
font-weight: 600;
font-size: 0.95rem;
}
.external a {
transition: opacity 0.18s ease, translate 0.18s ease, box-shadow 0.18s ease;
}
.external a:hover {
text-decoration: none;
opacity: 0.92;
translate: 0 -1px;
box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}
.external a:active { translate: 0 0; }
.external .aff-badge {
display: inline-block;
margin-left: 0.6rem;
padding: 0.15rem 0.5rem;
font-size: 0.7rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted);
background: var(--rule);
border-radius: 999px;
vertical-align: middle;
}
.aff-disclosure {
margin: 0.6rem 0 0;
font-size: 0.78rem;
color: var(--muted);
font-style: italic;
}
/* Colophon — understated meta block at the foot of a post.
Used on /reviews/, /find/, /bundles/ pages. */
.colophon {
margin: 3rem 0 0;
padding-top: 1.5rem;
border-top: 1px solid var(--rule);
font-family: ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
font-size: 0.8rem;
line-height: 1.5;
color: var(--muted);
}
.colophon dl {
margin: 0;
display: grid;
grid-template-columns: max-content 1fr;
gap: 0.55rem 1.25rem;
align-items: baseline;
}
.colophon dt {
margin: 0;
font-size: 0.72rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
line-height: 1.5;
color: var(--muted);
}
.colophon dd {
margin: 0;
color: var(--muted);
line-height: 1.5;
}
.colophon a {
color: var(--muted);
border-bottom: 1px solid var(--rule);
}
.colophon a:hover {
color: var(--accent);
border-bottom-color: currentColor;
text-decoration: none;
}
.colophon .colophon-tags {
display: flex;
flex-wrap: wrap;
gap: 0.35rem 0.75rem;
}
.colophon .colophon-tags a { border-bottom: 0; }
.colophon time { color: var(--muted); }
.colophon .aff-badge {
display: inline-block;
margin-left: 0.45rem;
padding: 0.1rem 0.4rem;
font-size: 0.62rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted);
background: var(--rule);
border-radius: 999px;
vertical-align: middle;
}
.colophon-aff {
margin: 1rem 0 0;
padding-top: 0.85rem;
border-top: 1px dashed var(--rule);
font-size: 0.72rem;
font-style: italic;
color: var(--muted);
}
@media (max-width: 520px) {
.colophon dl {
grid-template-columns: 1fr;
gap: 0.15rem 0;
}
.colophon dt { margin-top: 0.6rem; }
.colophon dt:first-child { margin-top: 0; }
}
</style>
<script>
// Fade media in on load instead of popping — see .fx-fade in the global
// styles. Only media still in flight is tagged, so cached images render
// instantly with no flash.
if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
for (const img of document.querySelectorAll('img')) {
if (img.complete) continue;
const reveal = () => img.classList.add('fx-in');
img.classList.add('fx-fade');
img.addEventListener('load', reveal, { once: true });
img.addEventListener('error', reveal, { once: true });
}
for (const video of document.querySelectorAll('video')) {
if (video.readyState >= 2) continue;
const reveal = () => video.classList.add('fx-in');
video.classList.add('fx-fade');
video.addEventListener('loadeddata', reveal, { once: true });
video.addEventListener('error', reveal, { once: true });
}
}
</script>
{import.meta.env.DEV && <EditConfirm />}
</body>
</html>