diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 321a9ca..96d0a88 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,6 +32,8 @@ jobs: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: diff --git a/backend/src/catalog.mjs b/backend/src/catalog.mjs index 4b810bb..8560682 100644 --- a/backend/src/catalog.mjs +++ b/backend/src/catalog.mjs @@ -42,6 +42,7 @@ export async function loadCatalog() { for await (const obj of pager) objects.push(obj); const images = new Map(objects.filter((o) => o.type === "IMAGE").map((o) => [o.id, o.imageData?.url])); + const imageCaptions = new Map(objects.filter((o) => o.type === "IMAGE").map((o) => [o.id, o.imageData?.caption?.trim() || ""])); const categories = new Map(objects.filter((o) => o.type === "CATEGORY").map((o) => [o.id, o.categoryData?.name])); // Square has moved items from one category to a list; the reporting category (else the first) is the shop's "type". const categoryOf = (d) => categories.get(d.reportingCategory?.id ?? d.categories?.[0]?.id ?? d.categoryId) ?? null; @@ -52,12 +53,14 @@ export async function loadCatalog() { .map((o) => { const shipLb = numberAttr(o, SHIP_LB_KEY); const itemLb = numberAttr(o, ITEM_LB_KEY); + const captions = (o.itemData.imageIds ?? []).map((id) => imageCaptions.get(id) ?? ""); return { id: o.id, name: o.itemData.name, description: o.itemData.descriptionPlaintext ?? o.itemData.description ?? "", image: images.get(o.itemData.imageIds?.[0]) ?? null, images: (o.itemData.imageIds ?? []).map((id) => images.get(id)).filter(Boolean), // in the order set in Square + ...(captions.some(Boolean) ? { imageCaptions: captions } : {}), category: categoryOf(o.itemData), ...(shipLb ? { shipLb } : {}), ...(itemLb ? { itemLb } : {}), diff --git a/backend/src/piece-page.mjs b/backend/src/piece-page.mjs index 6dfa492..4b0fd71 100644 --- a/backend/src/piece-page.mjs +++ b/backend/src/piece-page.mjs @@ -40,22 +40,74 @@ export function priceText(item) { return `${new Set(open.map((v) => v.price)).size > 1 ? "From " : ""}${money(low, open[0].currency)}`; } -/** The search-result description: the spec line, then where it was made. */ +const clipDesc = (s, max = 160) => { + if (s.length <= max) return s; + const cut = s.slice(0, max - 1); + const space = cut.lastIndexOf(" "); + return `${(space > 60 ? cut.slice(0, space) : cut).replace(/[.,;:!?-]+$/, "")}…`; +}; + +/** Search-result description combining spec line, lead sentence, and studio attribution (<= 160 chars). */ export function metaDescription(item) { const spec = specLine(item.description); - return spec ? `${spec}. Handmade in Tacoma by ${SITE_NAME}.` : `Handmade in Tacoma by ${SITE_NAME}.`; + const rest = descriptionRest(item.description)[0] ?? ""; + if (spec && rest) { + const base = `${spec.endsWith(".") ? spec : `${spec}.`} ${rest}`; + if (base.includes(SITE_NAME)) return clipDesc(base); + const ended = /[.!?]$/.test(base) ? base : `${base}.`; + for (const tail of [` Handmade by ${SITE_NAME}.`, ` ${SITE_NAME}.`]) { + if (ended.length + tail.length <= 160) return ended + tail; + } + return clipDesc(base); + } + if (spec) return clipDesc(`${spec.endsWith(".") ? spec : `${spec}.`} Handmade in Tacoma by ${SITE_NAME}.`); + if (rest) { + if (rest.includes(SITE_NAME)) return clipDesc(rest); + const ended = /[.!?]$/.test(rest) ? rest : `${rest}.`; + const tail = ` Handmade in Tacoma by ${SITE_NAME}.`; + return clipDesc(ended.length + tail.length <= 160 ? ended + tail : rest); + } + return `Handmade in Tacoma by ${SITE_NAME}.`; } -/** Page , adding "Handmade pottery" when the piece name has room (<= 60 characters). */ +/** Page <title>, adding "Handmade pottery", clay material, or "Pottery" when it fits <= 60 characters. */ export function pieceTitle(item) { const name = String(item.name ?? "").trim(); - if (!/pottery|ceramic/i.test(name)) { - const rich = `${name} – Handmade pottery | ${SITE_NAME}`; - if (rich.length <= 60) return rich; + if (!/pottery|ceramic|porcelain|stoneware/i.test(name)) { + const mat = materialOf(item); + const suffixes = ["Handmade pottery", ...(mat === "Porcelain" || mat === "Stoneware" ? [mat] : []), "Pottery"]; + for (const s of suffixes) { + const rich = `${name} – ${s} | ${SITE_NAME}`; + if (rich.length <= 60) return rich; + } } return `${name} | ${SITE_NAME}`; } +/** @type {[RegExp, string][]} */ +const COLOR_PATTERNS = [ + [/\bceladon[- ]green\b|\bceladon\b/i, "Celadon green"], + [/\bolive[- ]brown\b/i, "Olive brown"], + [/\bsage[- ]green\b/i, "Sage green"], + [/\bgrey[- ]green\b|\bgray[- ]green\b/i, "Grey-green"], + [/\bbrown[- ]grey\b|\bbrown[- ]gray\b/i, "Brown-grey"], + [/\bpale green\b/i, "Pale green"], + [/\brust[- ]red\b/i, "Rust red"], + [/\btenmoku\b|\btemmoku\b/i, "Dark brown"], + [/\bshino\b/i, "Warm white"], + [/\bcobalt\b/i, "Cobalt blue"], + [/\bdark brown\b/i, "Dark brown"], + [/\bwarm brown\b/i, "Warm brown"], +]; + +/** Infers the glaze color for Product.color / Google Shopping <g:color> from explicit color or glaze copy. */ +export function colorOf(item) { + if (typeof item.color === "string" && item.color.trim()) return item.color.trim(); + const text = `${item.name ?? ""} ${item.description ?? ""}`; + for (const [re, label] of COLOR_PATTERNS) if (re.test(text)) return label; + return null; +} + function materialOf(item) { const text = `${item.name ?? ""} ${item.description ?? ""}`; if (/porcelain/i.test(text) && /stoneware/i.test(text)) return "Porcelain and stoneware"; @@ -65,6 +117,8 @@ function materialOf(item) { } function photoAlt(item, i) { + const caption = item.imageCaptions?.[i]; + if (caption) return `${item.name} — ${caption}`; const spec = specLine(item.description); return i === 0 && spec ? `${item.name} — ${spec}` : `${item.name}, photo ${i + 1}`; } @@ -275,9 +329,10 @@ export function structuredData(item, site) { codeValue: gpc.codeValue, inCodeSet: GOOGLE_TAXONOMY, }; - const delivery = - item.shipLb > 0 ? ["https://schema.org/OnSitePickup", "https://schema.org/ParcelService"] : ["https://schema.org/OnSitePickup"]; + const rates = shippingRatesFor(item.shipLb); + const delivery = rates ? ["https://schema.org/OnSitePickup", "https://schema.org/ParcelService"] : ["https://schema.org/OnSitePickup"]; const shippingDetails = shippingDetailsFor(item.shipLb); + const color = colorOf(item); const crumbs = [ { name: "Home", item: `${site}/` }, { name: "Shop", item: `${site}/shop.html` }, @@ -297,13 +352,14 @@ export function structuredData(item, site) { image: photosOf(item).map((p) => site + sized(p, 1200, "jpeg")), category: item.category ? [item.category, categoryCode] : categoryCode, material: materialOf(item), + ...(color ? { color } : {}), countryOfOrigin: "US", ...(dims.depth ? { depth: qvIn(dims.depth) } : {}), ...(dims.width ? { width: qvIn(dims.width) } : {}), ...(dims.height ? { height: qvIn(dims.height) } : {}), ...(item.itemLb > 0 ? { weight: qvLb(item.itemLb) } : {}), - creator: { "@type": "Person", "@id": `${site}/about.html#aaron`, name: "Aaron Filson" }, - brand: { "@type": "Brand", name: SITE_NAME }, + creator: { "@type": "Person", "@id": `${site}/about.html#aaron`, name: "Aaron Filson", url: `${site}/about.html` }, + brand: { "@type": "Brand", "@id": `${site}/#store`, name: SITE_NAME, url: `${site}/` }, offers: item.variations.map((v) => ({ "@type": "Offer", ...(many ? { name: v.name } : {}), @@ -317,6 +373,8 @@ export function structuredData(item, site) { // policies.html: returns are not accepted (a piece broken in shipping is refunded). hasMerchantReturnPolicy: { "@type": "MerchantReturnPolicy", + "@id": `${site}/policies.html#returns`, + merchantReturnLink: `${site}/policies.html#returns`, applicableCountry: "US", returnPolicyCategory: "https://schema.org/MerchantReturnNotPermitted", }, @@ -358,41 +416,78 @@ function headTags(item, site) { ].join(""); } +function rotateList(list, offset) { + if (list.length <= 1) return list; + const k = offset % list.length; + return [...list.slice(k), ...list.slice(0, k)]; +} + +/** Picks up to `limit` available sibling pieces: same category first, rotated deterministically by item.id. */ +export function morePieces(item, items, limit = 4) { + const open = items.filter((i) => i.id !== item.id && i.variations.some(isOpen)); + if (!open.length) return []; + const same = item.category ? open.filter((i) => i.category === item.category) : []; + const other = item.category ? open.filter((i) => i.category !== item.category) : open; + if (open.length <= limit) return [...same, ...other].slice(0, limit); + let h = 0; + for (const ch of String(item.id ?? "")) h = (h * 31 + ch.charCodeAt(0)) >>> 0; + return [...rotateList(same, h), ...rotateList(other, h)].slice(0, limit); +} + function moreCard(item) { const photo = photosOf(item)[0]; return ( `<a class="card product-link" href="/p/${esc(item.id)}">` + (photo - ? picture(photo, { alt: "", sizes: "(max-width: 599px) 46vw, 260px", widths: [400, 800], eager: false }) + ? picture(photo, { alt: photoAlt(item, 0), sizes: "(max-width: 599px) 46vw, 260px", widths: [400, 800], eager: false }) : '<div class="ph"></div>') + `<div class="card-body"><h3>${esc(item.name)}</h3><span class="price">${esc(priceText(item))}</span></div></a>` ); } -/** What goes in <main>: photos, words, price, the way to buy, and a few other pieces. */ +/** What goes in <main>: photos, words, price, logistics, the way to buy, and other pieces. */ function body(item, items, { policies }) { const photos = photosOf(item); const sold = !item.variations.some(isOpen); const spec = specLine(item.description); const gallery = photos.length ? photos - .map((p, i) => - picture(p, { - alt: photoAlt(item, i), + .map((p, i) => { + const alt = photoAlt(item, i); + const pic = picture(p, { + alt, sizes: i ? "(min-width: 900px) 270px, 50vw" : "(min-width: 900px) 560px, 100vw", - widths: [800, 1600], // the sizes scripts/warm-photos.mjs makes for every photo + widths: i ? [400, 800, 1600] : [800, 1600], // the sizes scripts/warm-photos.mjs makes for every photo eager: i === 0, - }), - ) + }); + const zoom = `<a class="zoom" href="${esc(sized(p, 1600, "webp"))}" data-alt="${esc(alt)}" data-title="${esc(item.name)}"${spec ? ` data-desc="${esc(spec)}"` : ""}>${pic}</a>`; + return i === 0 && sold ? `<div class="piece-photo">${zoom}<span class="sold-badge">Sold</span></div>` : zoom; + }) .join("") - : '<div class="ph"></div>'; - const others = items.filter((i) => i.id !== item.id && i.variations.some(isOpen)).slice(0, 4); + : sold + ? `<div class="piece-photo"><div class="ph"></div><span class="sold-badge">Sold</span></div>` + : '<div class="ph"></div>'; + const rates = shippingRatesFor(item.shipLb); + const facts = sold + ? [] + : [ + ...(item.variations.length === 1 && item.variations[0].stock === 1 ? ["One of a kind — 1 available"] : []), + ...(item.itemLb > 0 ? [`Weight: ${+Number(item.itemLb).toFixed(2)} lb (${Math.round(Number(item.itemLb) * 16)} oz)`] : []), + rates + ? `Double-boxed insured US shipping in 1–2 business days (up to $${rates.wa} WA / $${rates.us} US), or free Tacoma pickup` + : "Tacoma studio pickup only — not available for shipping", + ...(rates ? ["Arrived broken? Email a photo for a full refund"] : []), + ]; + const others = morePieces(item, items, 4); // For piece-page.js, which turns the link below into Add to cart; stock as of this page. const data = { id: item.id, name: item.name, variations: item.variations.map(({ id, name, price, currency, stock }) => ({ id, name, price, currency, stock: stock ?? null })), }; + const soldCopy = item.category + ? `<p class="muted">This one-of-a-kind piece has found a home. <a href="/shop.html?type=${esc(encodeURIComponent(item.category))}">See available ${esc(item.category)}</a>, <a href="/shop.html">browse the shop</a>, or <a href="#signup">get notified when the next kiln opens</a>.</p>` + : `<p class="muted">This one-of-a-kind piece has found a home. <a href="/shop.html">See what's available</a>, or <a href="#signup">get notified when the next kiln opens</a>.</p>`; return ( `<div class="wrap piece-page">` + `<nav class="crumbs" aria-label="Breadcrumb"><ol><li><a href="/">Home</a></li><li><a href="/shop.html">Shop</a></li>` + @@ -405,10 +500,11 @@ function body(item, items, { policies }) { .map((t) => `<p>${esc(t)}</p>`) .join("")}</div>` + `<div class="piece-buy" id="piece-buy"><p class="price">${esc(priceText(item))}</p>` + - (sold - ? `<p class="muted">This piece has found a home. <a href="/shop.html">See what's available</a>.</p>` - : `<p><a class="btn" href="/shop.html#p-${esc(item.id)}">Buy in the shop</a></p>`) + + (sold ? soldCopy : `<p><a class="btn" href="/shop.html#p-${esc(item.id)}">Buy in the shop</a></p>`) + `</div>` + + (facts.length + ? `<ul class="piece-facts" aria-label="Piece and shipping details">${facts.map((f) => `<li>${esc(f)}</li>`).join("")}</ul>` + : "") + `<p class="piece-more"><a href="/care.html">Care & use</a>` + (policies ? `<a href="/policies.html">Shipping, pickup & returns</a>` : "") + `</p></div></div>` + @@ -499,20 +595,23 @@ export function piecesFeed(items, site) { /** * Google Merchant Center + Pinterest Catalogs RSS 2.0 XML product feed (/p/merchant.xml). - * Lists every unarchived piece with live availability (in_stock / out_of_stock), explicit - * identifier_exists=no for one-of-a-kind handmade work, Google Product Taxonomy ID, 3D dimensions, - * item + shipping weights, and WA / US Ground shipping rates. + * Lists every available piece (permanently sold one-of-a-kind items are omitted per Google Merchant + * Center guidelines), with identifier_exists=no (and no g:brand conflict), Google Product Taxonomy + * ID, glaze color, 3D dimensions, item + shipping weights, and WA / US Ground shipping rates. */ export function piecesMerchantFeed(items, site) { const entries = items.flatMap((item) => { + const open = item.variations.filter(isOpen); + if (!open.length) return []; const many = item.variations.length > 1; const url = `${site}/p/${item.id}`; const photos = photosOf(item); const dims = parseDimensions(item); const gpc = googleCategoryFor(item); + const color = colorOf(item); const rates = shippingRatesFor(item.shipLb); const desc = item.description?.trim() || metaDescription(item); - return item.variations.map((v) => { + return open.map((v) => { const id = many ? `${item.id}-${v.id}` : item.id; const title = many ? `${item.name} (${v.name})` : item.name; const fields = [ @@ -523,14 +622,14 @@ export function piecesMerchantFeed(items, site) { `<link>${esc(url)}</link>`, ...(photos[0] ? [`<g:image_link>${esc(site + sized(photos[0], 1200, "jpeg"))}</g:image_link>`] : []), ...photos.slice(1, 11).map((p) => `<g:additional_image_link>${esc(site + sized(p, 1200, "jpeg"))}</g:additional_image_link>`), - `<g:availability>${isOpen(v) ? "in_stock" : "out_of_stock"}</g:availability>`, + `<g:availability>in_stock</g:availability>`, `<g:price>${(v.price / 100).toFixed(2)} ${esc(v.currency ?? "USD")}</g:price>`, `<g:condition>new</g:condition>`, - `<g:brand>${SITE_NAME}</g:brand>`, `<g:identifier_exists>no</g:identifier_exists>`, `<g:google_product_category>${esc(gpc.codeValue)}</g:google_product_category>`, ...(item.category ? [`<g:product_type>${esc(item.category)}</g:product_type>`] : []), `<g:material>${esc(materialOf(item))}</g:material>`, + ...(color ? [`<g:color>${esc(color)}</g:color>`] : []), ...(dims.depth ? [`<g:product_length>${+dims.depth.toFixed(3)} in</g:product_length>`] : []), ...(dims.width ? [`<g:product_width>${+dims.width.toFixed(3)} in</g:product_width>`] : []), ...(dims.height ? [`<g:product_height>${+dims.height.toFixed(3)} in</g:product_height>`] : []), diff --git a/backend/test/shop-pages.test.mjs b/backend/test/shop-pages.test.mjs index c68a198..f75351c 100644 --- a/backend/test/shop-pages.test.mjs +++ b/backend/test/shop-pages.test.mjs @@ -5,7 +5,16 @@ import { handler, _setSquare } from "../src/handler.mjs"; import sharp from "sharp"; import { parseRequest, handler as images, _resetCatalog, _catalogWaits } from "../src/images.mjs"; import { _resetShell } from "../src/piece.mjs"; -import { renderPiece, structuredData, pieceTitle, parseDimensions, googleCategoryFor, GOOGLE_TAXONOMY } from "../src/piece-page.mjs"; +import { + renderPiece, + structuredData, + pieceTitle, + parseDimensions, + googleCategoryFor, + colorOf, + morePieces, + GOOGLE_TAXONOMY, +} from "../src/piece-page.mjs"; const SQUARE_PHOTO = "https://items-images-sandbox.s3.us-west-2.amazonaws.com/files/abc/original.jpeg"; @@ -187,7 +196,7 @@ test("a piece's page has its name, price, photos, words and product data, and no assert.match(res.body, /<meta property="og:image:alt" content="Celadon bowl — Cone 10 porcelain · celadon · 8″ × 3½″">/); assert.match( res.body, - /<meta name="description" content="Cone 10 porcelain · celadon · 8″ × 3½″\. Handmade in Tacoma by Updraft Pottery Studio\.">/, + /<meta name="description" content="Cone 10 porcelain · celadon · 8″ × 3½″\. Thrown in Tacoma\. Handmade by Updraft Pottery Studio\.">/, ); assert.match(res.body, /<meta property="product:price:amount" content="65\.00">/); assert.match(res.body, /<link rel="canonical" href="\/p\/I1">/); @@ -209,7 +218,10 @@ test("a piece's page has its name, price, photos, words and product data, and no }, ]); assert.equal(product.material, "Porcelain"); + assert.equal(product.color, "Celadon green"); assert.equal(product.countryOfOrigin, "US"); + assert.match(res.body, /class="zoom"/); + assert.match(res.body, /Double-boxed insured US shipping/); assert.deepEqual(product.depth, { "@type": "QuantitativeValue", value: 8, unitCode: "INH" }); assert.deepEqual(product.width, { "@type": "QuantitativeValue", value: 8, unitCode: "INH" }); assert.deepEqual(product.height, { "@type": "QuantitativeValue", value: 3.5, unitCode: "INH" }); @@ -280,16 +292,61 @@ test("3D dimensions, Google categories, and separate item vs shipping weights ar assert.deepEqual(pickupOnly.width, { "@type": "QuantitativeValue", value: 8, unitCode: "INH" }); assert.deepEqual(pickupOnly.height, { "@type": "QuantitativeValue", value: 5, unitCode: "INH" }); assert.equal(pickupOnly.weight, undefined, "shipLb/itemLb absent leaves Product.weight unset rather than faking it"); - assert.equal(pickupOnly.category.codeValue, "11"); + assert.ok(pickupOnly.category.codeValue === "11"); assert.equal(pickupOnly.offers[0].shippingDetails.doesNotShip, true); + assert.deepEqual(pickupOnly.offers[0].availableDeliveryMethod, ["https://schema.org/OnSitePickup"]); + const pickupHtml = renderPiece({ + item: { + id: "P1", + name: "Large sculpture", + description: "Cone 10 · 8″ × 5″", + variations: [{ id: "V", name: "R", price: 20000, stock: 1 }], + }, + items: [], + shell: null, + site: "", + }); + assert.match(pickupHtml, /Tacoma studio pickup only — not available for shipping/); }); -test("piece titles include 'Handmade pottery' when short enough, and stay within 60 characters", () => { +test("piece titles include 'Handmade pottery', clay material, or 'Pottery' when <= 60 characters", () => { assert.equal(pieceTitle({ name: "Lantern bowl" }), "Lantern bowl – Handmade pottery | Updraft Pottery Studio"); - assert.equal(pieceTitle({ name: "Celadon footed bowl" }), "Celadon footed bowl | Updraft Pottery Studio"); + assert.equal( + pieceTitle({ name: "Celadon footed bowl", description: "Cone 10 porcelain" }), + "Celadon footed bowl – Porcelain | Updraft Pottery Studio", + ); + assert.equal(pieceTitle({ name: "Celadon footed bowl" }), "Celadon footed bowl – Pottery | Updraft Pottery Studio"); assert.equal(pieceTitle({ name: "Ceramic vessel" }), "Ceramic vessel | Updraft Pottery Studio"); assert.ok(pieceTitle({ name: "Lantern bowl" }).length <= 60); - assert.ok(pieceTitle({ name: "Celadon footed bowl" }).length <= 60); + assert.ok(pieceTitle({ name: "Celadon footed bowl", description: "Cone 10 porcelain" }).length <= 60); + + assert.equal(colorOf({ name: "Bowl", description: "Sage-green Tacoma crackle" }), "Sage green"); + assert.equal(colorOf({ name: "Plain pot", description: "Cone 10 stoneware" }), null); + + const mk = (id, category, stock = 1) => ({ + id, + name: id, + category, + description: "", + variations: [{ id: `${id}v`, price: 1000, stock }], + }); + const catalog = [ + mk("B1", "Bowls"), + mk("B2", "Bowls"), + mk("V1", "Vases"), + mk("P1", "Plates"), + mk("B3", "Bowls"), + mk("V2", "Vases"), + mk("M1", "Mugs"), + ]; + const siblingsForV1 = morePieces(catalog[2], catalog, 4); + assert.equal(siblingsForV1[0].id, "V2", "same-category piece is prioritized first"); + assert.equal(siblingsForV1.length, 4); + const siblingsForB1 = morePieces(catalog[0], catalog, 4); + assert.deepEqual( + siblingsForB1.slice(0, 2).map((i) => i.category), + ["Bowls", "Bowls"], + ); }); test("a piece's page goes into the site's shell; without one it's a plain page kept out of search", async (t) => { @@ -309,6 +366,8 @@ test("a piece's page goes into the site's shell; without one it's a plain page k assert.match(html, /<main id="main"><div class="wrap piece-page">/); assert.match(html, /<a href="\/policies\.html">Shipping, pickup & returns<\/a>/, "the shell's menu has the policy page"); assert.match(html, /<p class="price">Sold<\/p>/); + assert.match(html, /<span class="sold-badge">Sold<\/span>/); + assert.match(html, /href="#signup"/); assert.ok(!html.includes("Buy in the shop"), "a sold piece has no way to buy"); assert.ok(!html.includes("noindex")); assert.equal(ld(html)["@graph"][0].offers[0].availability, "https://schema.org/SoldOut"); @@ -374,11 +433,13 @@ test("the pieces' sitemap and Atom feed list pieces with dates and photos", asyn assert.ok(merchant.body.includes('xmlns:g="http://base.google.com/ns/1.0"')); assert.ok(merchant.body.includes("<g:id>I1</g:id>")); assert.ok(merchant.body.includes("<g:identifier_exists>no</g:identifier_exists>")); + assert.ok(!merchant.body.includes("<g:brand>"), "omit g:brand when identifier_exists=no"); assert.ok(merchant.body.includes("<g:availability>in_stock</g:availability>")); assert.ok(merchant.body.includes("<g:price>65.00 USD</g:price>")); assert.ok(merchant.body.includes("<g:google_product_category>3498</g:google_product_category>")); assert.ok(merchant.body.includes("<g:product_type>Bowls</g:product_type>")); assert.ok(merchant.body.includes("<g:material>Porcelain</g:material>")); + assert.ok(merchant.body.includes("<g:color>Celadon green</g:color>")); assert.ok(merchant.body.includes("<g:product_length>8 in</g:product_length>")); assert.ok(merchant.body.includes("<g:product_width>8 in</g:product_width>")); assert.ok(merchant.body.includes("<g:product_height>3.5 in</g:product_height>")); @@ -388,4 +449,12 @@ test("the pieces' sitemap and Atom feed list pieces with dates and photos", asyn assert.ok(merchant.body.includes("<g:country>US</g:country><g:service>Ground</g:service><g:price>52.00 USD</g:price>")); assert.equal([...merchant.body.matchAll(/<g:image_link>/g)].length, 1); assert.equal([...merchant.body.matchAll(/<g:additional_image_link>/g)].length, 1); + + const soldMerchant = await (async () => { + const sold = fakeCatalog(); + sold.inventory = { batchGetCounts: async () => iter([{ catalogObjectId: "V1", quantity: "0", calculatedAt: "2000-01-01T00:00:00Z" }]) }; + _setSquare(sold); + return get("/p/merchant.xml"); + })(); + assert.ok(!soldMerchant.body.includes("<g:id>I1</g:id>"), "permanently sold one-of-a-kind piece omitted from merchant.xml"); }); diff --git a/deploy/site.yaml b/deploy/site.yaml index 333a04a..cf2b8dd 100644 --- a/deploy/site.yaml +++ b/deploy/site.yaml @@ -247,6 +247,7 @@ Resources: "/kilns": "/kilns.html", "/terms": "/terms.html", "/shop": "/shop.html", + "/gifts": "/gifts.html", "/care": "/care.html", "/policies": "/policies.html", }; diff --git a/e2e/a11y.spec.mjs b/e2e/a11y.spec.mjs index ca35074..0c4c436 100644 --- a/e2e/a11y.spec.mjs +++ b/e2e/a11y.spec.mjs @@ -14,6 +14,7 @@ const pages = [ "/terms.html", "/care.html", "/policies.html", + "/gifts.html", "/shop.html", "/p/fixture-bowl", // a piece's page, drawn from e2e/fixtures/pieces.json (scripts/serve.mjs --pieces) "/no-such-page", diff --git a/e2e/menu.spec.mjs b/e2e/menu.spec.mjs index 0af2e98..410d628 100644 --- a/e2e/menu.spec.mjs +++ b/e2e/menu.spec.mjs @@ -9,6 +9,7 @@ const everyPage = [ "/kilns.html", "/terms.html", "/shop.html", + "/gifts.html", "/care.html", "/policies.html", "/shop.html#cart", diff --git a/e2e/pages.spec.mjs b/e2e/pages.spec.mjs index a4d7165..569c6c4 100644 --- a/e2e/pages.spec.mjs +++ b/e2e/pages.spec.mjs @@ -11,6 +11,7 @@ const pages = [ "/terms.html", "/care.html", "/policies.html", + "/gifts.html", "/shop.html", "/p/fixture-bowl", // a piece's page, drawn from e2e/fixtures/pieces.json (scripts/serve.mjs --pieces) "/no-such-page", diff --git a/e2e/piece-page.spec.mjs b/e2e/piece-page.spec.mjs index 67b1433..ff11cc2 100644 --- a/e2e/piece-page.spec.mjs +++ b/e2e/piece-page.spec.mjs @@ -20,7 +20,7 @@ const ld = async (page) => JSON.parse(await page.locator('script[type="applicati test("a piece's page has its name, price, product data and its own address", async ({ page }) => { await page.goto("/p/fixture-bowl"); - await expect(page).toHaveTitle("Celadon footed bowl | Updraft Pottery Studio"); + await expect(page).toHaveTitle("Celadon footed bowl – Porcelain | Updraft Pottery Studio"); await expect(page.locator("h1")).toHaveText("Celadon footed bowl"); await expect(page.locator(".piece-spec")).toHaveText("Cone 10 porcelain · celadon · 5½″ wide × 3″ tall"); await expect(page.locator('link[rel="canonical"]')).toHaveAttribute("href", /\/p\/fixture-bowl$/); @@ -68,7 +68,9 @@ test("Add to cart on a piece's page fills the shop's cart", async ({ page }) => test("a sold piece's page stays up, marked sold, with no way to buy", async ({ page }) => { await page.goto("/p/fixture-jar"); await expect(page.locator("h1")).toHaveText("Tenmoku jar"); + await expect(page.locator(".piece-gallery .sold-badge")).toHaveText("Sold"); await expect(page.locator(".piece-buy .price")).toHaveText("Sold"); + await expect(page.locator('.piece-buy a[href="#signup"]')).toBeVisible(); await expect(page.locator(".piece-buy button")).toHaveCount(0); expect((await ld(page))["@graph"][0].offers[0].availability).toBe("https://schema.org/SoldOut"); }); @@ -124,4 +126,10 @@ test("a photo the resizer is too busy for is asked for again, and loads resized" }) .toBe(true); expect(originals).toEqual([]); + + await page.locator(".piece-gallery a.zoom").first().click(); + await expect(page.locator("dialog.lightbox")).toBeVisible(); + await expect(page.locator("dialog.lightbox .lb-count")).toHaveText("1 of 2"); + await page.keyboard.press("Escape"); + await expect(page.locator("dialog.lightbox")).toBeHidden(); }); diff --git a/e2e/piece.spec.mjs b/e2e/piece.spec.mjs index 27fa6d1..e999a5c 100644 --- a/e2e/piece.spec.mjs +++ b/e2e/piece.spec.mjs @@ -167,8 +167,10 @@ test("cards link to each piece's own page, and search engines get the list of th await expect(page.locator("#p-item-jar")).toBeVisible(); await expect(page.locator("#p-item-bowl h3 a")).toHaveAttribute("href", "/p/item-bowl"); await expect(page.locator("#p-item-bowl a.media")).toHaveAttribute("href", "/p/item-bowl"); - const data = JSON.parse(await page.locator('head script[type="application/ld+json"]').last().textContent()); - expect(data.itemListElement.map((e) => [e.position, e.url.replace(/^.*\/p\//, "/p/")])).toEqual([ + const scripts = page.locator('head script[type="application/ld+json"]'); + await expect(scripts).toHaveCount(1); + const data = JSON.parse(await scripts.first().textContent()); + expect(data["@graph"][0].mainEntity.itemListElement.map((e) => [e.position, e.url.replace(/^.*\/p\//, "/p/")])).toEqual([ [1, "/p/item-bowl"], [2, "/p/item-jar"], ]); diff --git a/e2e/seo.spec.mjs b/e2e/seo.spec.mjs index 2b38e8c..b1d1185 100644 --- a/e2e/seo.spec.mjs +++ b/e2e/seo.spec.mjs @@ -13,6 +13,7 @@ const expectedTypes = [ ["/terms.html", "DefinedTermSet", ["Home", "Ceramic terms"]], ["/care.html", "WebPage", ["Home", "Shop", "Care & use"]], ["/policies.html", "WebPage", ["Home", "Shop", "Shipping, pickup & returns"]], + ["/gifts.html", "WebPage", ["Home", "Shop", "Pottery gifts"]], ]; for (const [path, type, crumbs] of expectedTypes) { @@ -41,6 +42,7 @@ test("canonical 301 redirects resolve /index.html and extensionless page URLs", ["/shop?type=Bowls", "/shop.html?type=Bowls"], ["/about/", "/about.html"], ["/past-work", "/past-work.html"], + ["/gifts", "/gifts.html"], ]) { const res = await request.get(from, { maxRedirects: 0 }); expect([from, res.status(), res.headers()["location"]]).toEqual([from, 301, to]); @@ -88,6 +90,11 @@ test("sitemap-pages.xml includes lastmod and high-res gallery images, and IndexN expect(locs.some((p) => /^\/img\/archive\/01-green-footed-bowl-1600-[0-9a-f]{8}\.webp$/.test(p))).toBe(true); const img = await request.get(locs[0]); expect(img.status()).toBe(200); + + const indexRes = await request.get("/sitemap.xml"); + expect(indexRes.status()).toBe(200); + const indexXml = await indexRes.text(); + expect(indexXml).toMatch(/<loc>https:\/\/[^<]+\/sitemap-pages\.xml<\/loc><lastmod>\d{4}-\d{2}-\d{2}<\/lastmod>/); }); test("the Atom feed (/p/feed.xml) lists available pieces and skips sold ones", async ({ request }) => { @@ -100,18 +107,20 @@ test("the Atom feed (/p/feed.xml) lists available pieces and skips sold ones", a expect(xml).not.toContain("Tenmoku jar"); // sold }); -test("the Merchant Center feed (/p/merchant.xml) exposes Google Shopping fields and stock states", async ({ request }) => { +test("the Merchant Center feed (/p/merchant.xml) exposes Google Shopping fields and omits sold items", async ({ request }) => { const res = await request.get("/p/merchant.xml"); expect(res.status()).toBe(200); const xml = await res.text(); expect(xml).toContain('xmlns:g="http://base.google.com/ns/1.0"'); expect(xml).toContain("<g:id>fixture-bowl</g:id>"); expect(xml).toContain("<g:identifier_exists>no</g:identifier_exists>"); + expect(xml).not.toContain("<g:brand>"); + expect(xml).toContain("<g:color>Celadon green</g:color>"); expect(xml).toContain("<g:product_length>5.5 in</g:product_length>"); expect(xml).toContain("<g:product_weight>1.75 lb</g:product_weight>"); expect(xml).toContain("<g:shipping_weight>14 lb</g:shipping_weight>"); expect(xml).toContain("<g:availability>in_stock</g:availability>"); - expect(xml).toContain("<g:availability>out_of_stock</g:availability>"); // fixture-jar + expect(xml).not.toContain("fixture-jar"); // permanently sold OOAK item omitted }); test.describe("without JavaScript", () => { diff --git a/package.json b/package.json index e56ce77..aaa01d2 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "warm-photos": "node scripts/warm-photos.mjs", "put-token": "node scripts/put-token.mjs", "load-test": "node scripts/load-test-checkout.mjs", - "seo-logs": "node scripts/seo-logs.mjs" + "seo-logs": "node scripts/seo-logs.mjs", + "gsc": "node scripts/gsc.mjs" }, "devDependencies": { "@aws-sdk/client-ssm": "^3.1172.0", diff --git a/scripts/build.mjs b/scripts/build.mjs index 4879a5d..46a78c0 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -17,6 +17,7 @@ import { minify } from "html-minifier-terser"; import { currentStage } from "./stage.mjs"; import { INDEXNOW_KEY } from "./indexnow.mjs"; import { priceText, specLine } from "../backend/src/piece-page.mjs"; +import { availableNow } from "../site/js/shop-logic.js"; const ROOT = path.resolve(import.meta.dirname, ".."); const SRC = path.join(ROOT, "site"); @@ -54,6 +55,7 @@ const NAV = [ "Shop", [ ["/shop.html", "All pieces"], + ["/gifts.html", "Pottery gifts"], ["/care.html", "Care & use"], ["/policies.html", "Shipping, pickup & returns"], ], @@ -203,14 +205,19 @@ async function gallery(file, meta, { eagerFirst = false, only = undefined } = {} return `<div class="gallery">${items.map((e, i) => figureHtml(e, meta, eagerFirst && (i === 0 ? "high" : i < EAGER_TILES), only)).join("\n")}</div>`; } -// Hero slideshow of the artist photos, newest number first (09 -> 01). Only the first slide loads -// with the page; the script swaps data-srcset -> srcset one slide ahead of showing it. -// It and the About gallery both use only the 800px files (HERO_WIDTHS), so each photo downloads once. +// Hero slideshow: 3 featured pottery pieces first so finished work appears above the fold, +// followed by artist photos newest number first (09 -> 01). Only the first slide loads with the page; +// the script swaps data-srcset -> srcset one slide ahead of showing it. +// Uses 800px files (HERO_WIDTHS) so photos shared with galleries download once. const HERO_WIDTHS = [800]; +const HERO_WORK_IMAGES = ["images/work/08.jpg", "images/work/06.jpg", "images/work/04.jpg"]; async function heroShow(meta) { - const entries = JSON.parse(await readFile(path.join(SRC, "data", "artist.json"), "utf8")).sort((a, b) => + const workByImage = new Map(JSON.parse(await readFile(path.join(SRC, "data", "work.json"), "utf8")).map((e) => [e.image, e])); + const featuredWork = HERO_WORK_IMAGES.map((img) => workByImage.get(img)).filter(Boolean); + const artistEntries = JSON.parse(await readFile(path.join(SRC, "data", "artist.json"), "utf8")).sort((a, b) => b.image.localeCompare(a.image, undefined, { numeric: true }), ); + const entries = [...featuredWork, ...artistEntries]; const sizes = "(min-width:700px) 46vw, 100vw"; const slides = entries.map((e, i) => { const m = meta[e.image]; @@ -227,7 +234,7 @@ async function heroShow(meta) { <figcaption>${esc(e.title)}</figcaption> </figure>`; }); - return `<div class="hero-show" role="group" aria-roledescription="slideshow" aria-label="Photos of the potter and the Pacific Northwest"> + return `<div class="hero-show" role="group" aria-roledescription="slideshow" aria-label="Photos of handmade pottery, the potter, and the Pacific Northwest"> ${slides.join("\n")} <button class="hero-pause" type="button" aria-label="Pause slideshow" hidden><span aria-hidden="true"></span></button> </div>`; @@ -370,6 +377,7 @@ const CRUMBS = { "terms.html": [["Home", "/"], ["Ceramic terms"]], "care.html": [["Home", "/"], ["Shop", "/shop.html"], ["Care & use"]], "policies.html": [["Home", "/"], ["Shop", "/shop.html"], ["Shipping, pickup & returns"]], + "gifts.html": [["Home", "/"], ["Shop", "/shop.html"], ["Pottery gifts"]], }; function crumbsHtml(name) { @@ -418,7 +426,7 @@ function termsSchema(terms, url) { } // Structured data (@graph) per static page. Piece pages get Product + BreadcrumbList from backend/src/piece-page.mjs. -function pageSchema(name, html, { ogs, icon512, email, meta, archive, terms, catalog }) { +function pageSchema(name, html, { ogs, icon512, email, meta, archive, terms, catalog, kilnsMod }) { if (name === SHELL || name === "error.html" || /<meta name="robots" content="noindex"/.test(html)) return null; const url = pageUrl(name); const storeId = `${SITE_URL}/#store`; @@ -532,21 +540,26 @@ function pageSchema(name, html, { ogs, icon512, email, meta, archive, terms, cat "@type": "Article", "@id": `${url}#kiln-shed`, url: `${url}#kiln-shed`, - headline: "The updraft kiln shed", - description: "Housing the propane updraft kiln at Updraft Pottery Studio in Tacoma, Washington.", + headline: "The propane updraft kiln in Tacoma", + description: "Building the concrete pad, burner plumbing, vent hood, and firebrick updraft kiln in Tacoma, Washington.", + datePublished: "2024-01-01", + dateModified: kilnsMod, image: SITE_URL + largestWebp(meta["images/kiln-shed/01.jpg"]), - author: { "@type": "Person", "@id": personId, name: "Aaron Filson" }, - publisher: { "@type": "OnlineStore", "@id": storeId, name: SITE_NAME }, + author: { "@type": "Person", "@id": personId, name: "Aaron Filson", url: pageUrl("about.html") }, + publisher: { "@type": "OnlineStore", "@id": storeId, name: SITE_NAME, logo: SITE_URL + icon512 }, }, { "@type": "Article", "@id": `${url}#soda-kiln`, url: `${url}#soda-kiln`, - headline: "The soda kiln", - description: "Building and firing a salt and soda kiln at Elinor Maroney's studio in Covington, Washington.", + headline: "The salt and soda kiln in Covington", + description: + "Building and firing a salt and soda kiln with a steel swing door at Elinor Maroney's studio in Covington, Washington.", + datePublished: "2024-01-01", + dateModified: kilnsMod, image: SITE_URL + largestWebp(meta["images/soda-kiln/01.jpg"]), - author: { "@type": "Person", "@id": personId, name: "Aaron Filson" }, - publisher: { "@type": "OnlineStore", "@id": storeId, name: SITE_NAME }, + author: { "@type": "Person", "@id": personId, name: "Aaron Filson", url: pageUrl("about.html") }, + publisher: { "@type": "OnlineStore", "@id": storeId, name: SITE_NAME, logo: SITE_URL + icon512 }, }, ], }; @@ -611,11 +624,14 @@ function headMeta(name, html, shared) { `<meta name="theme-color" content="${BG.dark}" media="(prefers-color-scheme: dark)">`, ]; if (!INDEXABLE) tags.push(`<meta name="robots" content="noindex">`); - // The piece shell gets its address and preview from the API, per piece (backend/src/piece-page.mjs). + // The piece shell gets its per-piece address and preview from the API (backend/src/piece-page.mjs), + // while still exposing the Atom feed link in <head>. + if (INDEXABLE && !/<meta name="robots" content="noindex"/.test(html)) { + tags.push(`<link rel="alternate" type="application/atom+xml" title="${SITE_NAME} — Available Pieces" href="${SITE_URL}/p/feed.xml">`); + } if (INDEXABLE && name !== SHELL && !/<meta name="robots" content="noindex"/.test(html)) { tags.push( `<link rel="canonical" href="${pageUrl(name)}">`, - `<link rel="alternate" type="application/atom+xml" title="${SITE_NAME} — Available Pieces" href="${SITE_URL}/p/feed.xml">`, `<meta property="og:site_name" content="${SITE_NAME}">`, `<meta property="og:type" content="website">`, `<meta property="og:title" content="${title}">`, @@ -685,18 +701,18 @@ async function loadPrerenderCatalog() { } const sizedCatalogUrl = (url, w, f) => `/api/img?u=${encodeURIComponent(url)}&w=${w}&f=${f}`; -function catalogPic(url, sizes) { +function catalogPic(url, sizes, alt = "") { const set = (f) => [400, 800].map((w) => `${sizedCatalogUrl(url, w, f)} ${w}w`).join(", "); return ( `<picture><source type="image/avif" srcset="${esc(set("avif"))}" sizes="${sizes}">` + - `<img src="${esc(sizedCatalogUrl(url, 400, "webp"))}" srcset="${esc(set("webp"))}" sizes="${sizes}" width="800" height="800" alt="" loading="lazy" decoding="async"></picture>` + `<img src="${esc(sizedCatalogUrl(url, 400, "webp"))}" srcset="${esc(set("webp"))}" sizes="${sizes}" width="800" height="800" alt="${esc(alt)}" loading="lazy" decoding="async"></picture>` ); } const PH_BODY = '<div class="ph"></div><div class="card-body"><span class="ph-title"> </span><span class="price"> </span></div>'; function renderAvailable(items) { - const open = items.filter((i) => (i.variations ?? []).some((v) => (v.stock ?? null) !== 0)).slice(0, 4); + const open = availableNow(items, 4); if (!open.length) { return { attrs: ' aria-busy="true"', @@ -705,9 +721,11 @@ function renderAvailable(items) { } const cards = open.map((i) => { const img = i.images?.[0] ?? i.image; + const spec = specLine(i.description); + const alt = spec ? `${i.name} — ${spec}` : i.name; return ( `<a class="card product-link" href="/p/${esc(i.id)}">` + - (img ? catalogPic(img, "(max-width: 599px) 46vw, 260px") : '<div class="ph"></div>') + + (img ? catalogPic(img, "(max-width: 599px) 46vw, 260px", alt) : '<div class="ph"></div>') + `<div class="card-body"><h3>${esc(i.name)}</h3><span class="price">${esc(priceText(i))}</span></div></a>` ); }); @@ -724,9 +742,10 @@ function renderShopCards(items) { const cards = items.map((i) => { const img = i.images?.[0] ?? i.image; const spec = specLine(i.description); + const alt = spec ? `${i.name} — ${spec}` : i.name; return ( `<article class="card"><a class="media" href="/p/${esc(i.id)}" tabindex="-1" aria-hidden="true">` + - (img ? catalogPic(img, "(max-width: 599px) 46vw, 300px") : '<div class="ph"></div>') + + (img ? catalogPic(img, "(max-width: 599px) 46vw, 300px", alt) : '<div class="ph"></div>') + `</a><div class="card-body"><h3><a href="/p/${esc(i.id)}">${esc(i.name)}</a></h3>` + (spec ? `<p class="spec">${esc(spec)}</p>` : "") + `<div class="row"><span class="price">${esc(priceText(i))}</span></div></div></article>` @@ -745,23 +764,31 @@ const PAGE_SOURCES = { "terms.html": ["site/terms.html", "site/data/terms.json"], "care.html": ["site/care.html"], "policies.html": ["site/policies.html", "site/data/site.json"], + "gifts.html": ["site/gifts.html"], "shop.html": ["site/shop.html"], }; -async function lastMod(pageName) { +async function lastMod(pageName, catalogLatest = "") { const files = PAGE_SOURCES[pageName] ?? [`site/${pageName}`]; + let mod = ""; try { const out = execFileSync("git", ["log", "-1", "--format=%cs", "--", ...files], { cwd: ROOT, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], }).trim(); - if (/^\d{4}-\d{2}-\d{2}$/.test(out)) return out; + if (/^\d{4}-\d{2}-\d{2}$/.test(out)) mod = out; } catch { - /* git unavailable or shallow checkout: fall back to file mtime */ + /* git unavailable: fall back to file mtime */ + } + if (!mod) { + const times = await Promise.all(files.map(async (f) => (await stat(path.join(ROOT, f))).mtimeMs)); + mod = new Date(Math.max(...times)).toISOString().slice(0, 10); } - const times = await Promise.all(files.map(async (f) => (await stat(path.join(ROOT, f))).mtimeMs)); - return new Date(Math.max(...times)).toISOString().slice(0, 10); + if ((pageName === "index.html" || pageName === "shop.html") && catalogLatest && catalogLatest > mod) { + return catalogLatest; + } + return mod; } await rm(OUT, { recursive: true, force: true }); @@ -835,7 +862,25 @@ const common = (current, js = assets.site) => ({ "{{contactEmail}}": esc(email), "{{signup}}": signup, // in the footer; the home page places it mid-page instead }); -const shared = { ogs, apple, icon512, email, pinterestVerify, meta, archive: archiveData, terms: termsData, catalog: catalogData }; +const catalogLatest = + catalogData + .map((i) => i.updatedAt?.slice(0, 10) ?? "") + .filter((d) => /^\d{4}-\d{2}-\d{2}$/.test(d)) + .sort() + .at(-1) ?? ""; +const kilnsMod = await lastMod("kilns.html"); +const shared = { + ogs, + apple, + icon512, + email, + pinterestVerify, + meta, + archive: archiveData, + terms: termsData, + catalog: catalogData, + kilnsMod, +}; const available = renderAvailable(catalogData); const shopCards = renderShopCards(catalogData); @@ -887,6 +932,7 @@ const sizes = { ), "terms.html": await page("terms.html", { ...common("/terms.html"), "<!--terms-->": termsHtml(termsData) }, shared), "care.html": await page("care.html", common("/care.html"), shared), + "gifts.html": await page("gifts.html", common("/gifts.html"), shared), ...(email ? { "policies.html": await page("policies.html", common("/policies.html"), shared) } : {}), "shop.html": await page( "shop.html", @@ -928,9 +974,11 @@ if (INDEXABLE) await writeFile(path.join(OUT, `${INDEXNOW_KEY}.txt`), `${INDEXNO // sitemap.xml names two: this build's pages (with their high-res gallery photos and last-modified dates), // and every piece's page, which the API lists from Square (/p/sitemap.xml, backend/src/piece.mjs). if (SITE_URL && INDEXABLE) { + const mods = []; const urlEntries = await Promise.all( indexable.map(async (n) => { - const mod = await lastMod(n); + const mod = await lastMod(n, catalogLatest); + mods.push(mod); const imgs = (pageImages[n] ?? []) .map((u) => `\n <image:image><image:loc>${esc(SITE_URL + u)}</image:loc></image:image>`) .join(""); @@ -939,6 +987,7 @@ if (SITE_URL && INDEXABLE) { : ` <url><loc>${esc(pageUrl(n))}</loc><lastmod>${mod}</lastmod></url>`; }), ); + const maxStaticMod = mods.sort().at(-1) ?? ""; await writeFile( path.join(OUT, "sitemap-pages.xml"), `<?xml version="1.0" encoding="UTF-8"?> @@ -951,8 +1000,8 @@ ${urlEntries.join("\n")} path.join(OUT, "sitemap.xml"), `<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> - <sitemap><loc>${SITE_URL}/sitemap-pages.xml</loc></sitemap> - <sitemap><loc>${SITE_URL}/p/sitemap.xml</loc></sitemap> + <sitemap><loc>${SITE_URL}/sitemap-pages.xml</loc>${maxStaticMod ? `<lastmod>${maxStaticMod}</lastmod>` : ""}</sitemap> + <sitemap><loc>${SITE_URL}/p/sitemap.xml</loc>${catalogLatest ? `<lastmod>${catalogLatest}</lastmod>` : ""}</sitemap> </sitemapindex> `, ); diff --git a/scripts/gsc.mjs b/scripts/gsc.mjs new file mode 100644 index 0000000..098711e --- /dev/null +++ b/scripts/gsc.mjs @@ -0,0 +1,215 @@ +// Queries Google Search Console (sitemaps, search analytics, and live URL/Rich-Result inspection) +// using local gcloud Application Default Credentials (no static service-account keys needed). +// npm run gsc sitemaps + last 28 days analytics + inspect key/piece URLs +// npm run gsc -- --days 90 analytics over 90 days +// npm run gsc -- --no-inspect skip per-URL inspection (faster) +// npm run gsc -- --inspect <url> print full URL inspection JSON for one URL +// npm run gsc -- --submit-sitemap submit https://updraftpotterystudio.com/sitemap.xml +// npm run gsc -- --submit-feed submit https://updraftpotterystudio.com/p/feed.xml +import { readFileSync } from "node:fs"; +import { homedir } from "node:os"; +import path from "node:path"; + +const SITE_HOST = "updraftpotterystudio.com"; +const SITE_URL = `https://${SITE_HOST}`; +const args = process.argv.slice(2); +const opt = (name) => (args.includes(name) ? args[args.indexOf(name) + 1] : undefined); +const days = Math.max(1, Number(opt("--days") ?? 28)); +const inspectOne = opt("--inspect"); +const skipInspect = args.includes("--no-inspect"); +const submitSitemap = args.includes("--submit-sitemap"); +const submitFeed = args.includes("--submit-feed"); + +function loadAdc() { + const file = + process.env.GOOGLE_APPLICATION_CREDENTIALS || path.join(homedir(), ".config", "gcloud", "application_default_credentials.json"); + try { + return JSON.parse(readFileSync(file, "utf8")); + } catch (err) { + throw new Error( + `Could not read ADC credentials at ${file} (${err.message}). Run:\n` + + ` gcloud auth application-default login --scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/webmasters`, + { cause: err }, + ); + } +} + +async function accessToken(adc) { + const body = new URLSearchParams({ + client_id: adc.client_id, + client_secret: adc.client_secret, + refresh_token: adc.refresh_token, + grant_type: "refresh_token", + }); + const res = await fetch("https://oauth2.googleapis.com/token", { + method: "POST", + headers: { "content-type": "application/x-www-form-urlencoded" }, + body, + signal: AbortSignal.timeout(10_000), + }); + const data = await res.json(); + if (!res.ok || !data.access_token) throw new Error(`OAuth token refresh failed: ${JSON.stringify(data)}`); + return data.access_token; +} + +const adc = loadAdc(); +const quotaProject = process.env.GSC_QUOTA_PROJECT || adc.quota_project_id || ""; +const token = await accessToken(adc); + +/** + * @param {string} url + * @param {{ method?: string, body?: unknown }} [opts] + */ +async function gscFetch(url, { method = "GET", body } = {}) { + /** @type {Record<string, string>} */ + const headers = { authorization: `Bearer ${token}` }; + if (quotaProject) headers["x-goog-user-project"] = quotaProject; + if (body !== undefined) headers["content-type"] = "application/json"; + const res = await fetch(url, { + method, + headers, + body: body !== undefined ? JSON.stringify(body) : undefined, + signal: AbortSignal.timeout(15_000), + }); + const text = await res.text(); + const data = text ? JSON.parse(text) : {}; + if (!res.ok) throw new Error(`${method} ${url} -> HTTP ${res.status}: ${data.error?.message ?? text}`); + return data; +} + +const { siteEntry = [] } = await gscFetch("https://searchconsole.googleapis.com/webmasters/v3/sites"); +const CANDIDATE_PROPERTIES = [ + `sc-domain:${SITE_HOST}`, + `${SITE_URL}/`, + `http://${SITE_HOST}/`, + `https://www.${SITE_HOST}/`, + `http://www.${SITE_HOST}/`, +]; +const match = CANDIDATE_PROPERTIES.map((u) => siteEntry.find((s) => s.siteUrl === u)).find(Boolean); + +if (!match) { + console.log("Accessible Search Console properties:", siteEntry.map((s) => s.siteUrl).join(", ") || "(none)"); + throw new Error(`No Search Console property matching ${SITE_HOST} found for this Google account.`); +} + +const property = match.siteUrl; +const encProp = encodeURIComponent(property); +console.log(`Property: ${property} (${match.permissionLevel})`); + +if (submitSitemap) { + const sm = `${SITE_URL}/sitemap.xml`; + await gscFetch(`https://searchconsole.googleapis.com/webmasters/v3/sites/${encProp}/sitemaps/${encodeURIComponent(sm)}`, { + method: "PUT", + }); + console.log(`Submitted sitemap: ${sm}`); +} + +if (submitFeed) { + const feedUrl = `${SITE_URL}/p/feed.xml`; + await gscFetch(`https://searchconsole.googleapis.com/webmasters/v3/sites/${encProp}/sitemaps/${encodeURIComponent(feedUrl)}`, { + method: "PUT", + }); + console.log(`Submitted feed: ${feedUrl}`); +} + +if (inspectOne) { + const out = await gscFetch("https://searchconsole.googleapis.com/v1/urlInspection/index:inspect", { + method: "POST", + body: { inspectionUrl: inspectOne, siteUrl: property }, + }); + console.log(JSON.stringify(out.inspectionResult, null, 2)); + process.exit(0); +} + +// 1. Sitemaps +console.log("\n== Sitemaps"); +const { sitemap = [] } = await gscFetch(`https://searchconsole.googleapis.com/webmasters/v3/sites/${encProp}/sitemaps`); +if (!sitemap.length) { + console.log(" (none submitted — run: npm run gsc -- --submit-sitemap)"); +} else { + for (const s of sitemap) { + const counts = (s.contents ?? []).map((c) => `${c.type}: ${c.submitted ?? 0} submitted / ${c.indexed ?? 0} indexed`).join(", "); + console.log( + ` ${s.path} lastRead=${s.lastDownloaded?.slice(0, 16) ?? "never"} errors=${s.errors ?? 0} warnings=${s.warnings ?? 0}${counts ? ` [${counts}]` : ""}`, + ); + } +} + +// 2. Search Analytics +const fmtDate = (d) => d.toISOString().slice(0, 10); +const end = new Date(); +const start = new Date(Date.now() - days * 86_400_000); +const queryAnalytics = (dimensions, rowLimit = 15) => + gscFetch(`https://searchconsole.googleapis.com/webmasters/v3/sites/${encProp}/searchAnalytics/query`, { + method: "POST", + body: { startDate: fmtDate(start), endDate: fmtDate(end), dimensions, rowLimit }, + }); + +const [totals, byQuery, byPage] = await Promise.all([queryAnalytics([]), queryAnalytics(["query"], 15), queryAnalytics(["page"], 15)]); +const tRow = totals.rows?.[0]; +console.log( + `\n== Search Performance (${fmtDate(start)} to ${fmtDate(end)}): ` + + (tRow + ? `${tRow.clicks} clicks, ${tRow.impressions} impressions, CTR ${(tRow.ctr * 100).toFixed(1)}%, avg pos ${tRow.position.toFixed(1)}` + : "no clicks/impressions recorded yet"), +); + +if (byQuery.rows?.length) { + console.log("\n== Top Queries"); + for (const r of byQuery.rows) { + console.log( + ` ${String(r.clicks).padStart(4)} clicks ${String(r.impressions).padStart(5)} impr pos ${r.position.toFixed(1).padStart(4)} ${r.keys[0]}`, + ); + } +} + +if (byPage.rows?.length) { + console.log("\n== Top Pages"); + for (const r of byPage.rows) { + console.log( + ` ${String(r.clicks).padStart(4)} clicks ${String(r.impressions).padStart(5)} impr pos ${r.position.toFixed(1).padStart(4)} ${r.keys[0]}`, + ); + } +} + +// 3. URL Inspection across static pages + live pieces +if (!skipInspect) { + const staticUrls = [ + "/", + "/shop.html", + "/past-work.html", + "/about.html", + "/kilns.html", + "/terms.html", + "/care.html", + "/policies.html", + "/gifts.html", + ].map((p) => `${SITE_URL}${p}`); + let pieceUrls = []; + try { + const xml = await (await fetch(`${SITE_URL}/p/sitemap.xml`, { signal: AbortSignal.timeout(8_000) })).text(); + pieceUrls = [...xml.matchAll(/<loc>([^<]+)<\/loc>/g)].map((m) => m[1]); + } catch { + /* optional */ + } + const urls = [...staticUrls, ...pieceUrls]; + console.log(`\n== URL Inspection (${urls.length} URLs)`); + for (const u of urls) { + const { inspectionResult: r } = await gscFetch("https://searchconsole.googleapis.com/v1/urlInspection/index:inspect", { + method: "POST", + body: { inspectionUrl: u, siteUrl: property }, + }); + const idx = r.indexStatusResult ?? {}; + const rich = (r.richResultsResult?.detectedItems ?? []) + .map((d) => { + const issues = (d.items ?? []).flatMap((i) => i.issues ?? []).map((x) => `${x.severity}:${x.issueMessage}`); + return issues.length ? `${d.richResultType}(${issues.join("; ")})` : d.richResultType; + }) + .join(", "); + const crawled = idx.lastCrawlTime ? idx.lastCrawlTime.slice(0, 16) : "never"; + const pathLabel = u.replace(SITE_URL, "") || "/"; + console.log( + ` ${(idx.verdict ?? "UNKNOWN").padEnd(7)} ${(idx.coverageState ?? "unknown").padEnd(32)} crawled=${crawled} ${pathLabel}${rich ? ` [${rich}]` : ""}`, + ); + } +} diff --git a/scripts/serve.mjs b/scripts/serve.mjs index cf74685..f70f28f 100644 --- a/scripts/serve.mjs +++ b/scripts/serve.mjs @@ -41,6 +41,7 @@ const REDIRECT_PATHS = new Map([ ["/kilns", "/kilns.html"], ["/terms", "/terms.html"], ["/shop", "/shop.html"], + ["/gifts", "/gifts.html"], ["/care", "/care.html"], ["/policies", "/policies.html"], ]); diff --git a/scripts/warm-photos.mjs b/scripts/warm-photos.mjs index 859367a..5c02aac 100644 --- a/scripts/warm-photos.mjs +++ b/scripts/warm-photos.mjs @@ -21,7 +21,7 @@ const MAIN = [ [1600, "webp"], [1200, "jpeg"], ]; -const OTHER = MAIN.filter(([w]) => w !== 400); +const OTHER = MAIN; const res = await fetch(`${stage.siteUrl}/api/catalog`); if (!res.ok) throw new Error(`${stage.siteUrl}/api/catalog answered ${res.status}`); diff --git a/site/about.html b/site/about.html index 13de640..8bab887 100644 --- a/site/about.html +++ b/site/about.html @@ -30,12 +30,16 @@ <h1 class="page-title">About the studio</h1> <p> From 2010 to 2018 I worked with Elinor Maroney at her studio in Covington, Washington. Elinor has been working in clay for more than 50 years and is a wonderful artist. I learned immensely from Elinor, and in turn I assisted - with the heavy lifting. I constructed a soda kiln at the studio so we could experiment with atmospheric glazing and - learn the fine details of this challenging process. You can see that project on the <a href="/kilns.html">kilns page</a>. + with the heavy lifting. I constructed a soda kiln at the studio so we could experiment with + <a href="/terms.html#soda-fired">atmospheric glazing</a> and learn the fine details of this challenging + process. You can see that project on the <a href="/kilns.html">kilns page</a> and browse pieces from those + years in <a href="/past-work.html">past work</a>. </p> <p> Updraft Pottery Studio is my studio in Tacoma. It has the right electrical to run kilns, wheels, and lights at the - same time, and a propane kiln undergoing the 12th (ish) rebuild. Follow along with new work and kiln openings on + same time, and a propane kiln undergoing the 12th (ish) rebuild. Orders ship across the US or can be picked up + by appointment—see <a href="/policies.html">shipping & pickup</a>. Follow along with new work and kiln + openings on <a href="https://www.instagram.com/aaronmakespottery/">Instagram</a> and <a href="https://www.facebook.com/AaronFilsonCeramics/">Facebook</a>. </p> diff --git a/site/care.html b/site/care.html index 7377347..f944722 100644 --- a/site/care.html +++ b/site/care.html @@ -57,9 +57,12 @@ <h2>Sudden temperature changes</h2> <h2>Living with handmade pots</h2> <p> - No two pieces are exactly alike, especially from the soda kiln, where the flashing is different on every pot. - Metal utensils can leave grey marks on some glazes over time; a paste of baking soda and water lifts them. + No two pieces are exactly alike, especially from the <a href="/kilns.html#soda-kiln">soda kiln</a>, where the + flashing is different on every pot. Metal utensils can leave grey marks on some glazes over time; a paste of baking + soda and water lifts them. Every shipped order leaves Tacoma double boxed with insurance, covered by a full refund + if anything breaks on the way—see <a href="/policies.html">shipping, pickup & returns</a>. </p> + <p class="more"><a href="/shop.html">Browse available pieces in the shop →</a></p> </section> </main> <!--footer--> diff --git a/site/css/style.css b/site/css/style.css index f2d61e1..00f0ea0 100644 --- a/site/css/style.css +++ b/site/css/style.css @@ -316,8 +316,10 @@ section > h2 + .lede, section > .lede { margin-bottom: 1.5rem; } @media (min-width: 900px) { .piece-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } .piece-about { position: sticky; top: 5rem; } } .piece-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; } .piece-gallery > :first-child { grid-column: 1 / -1; } +.piece-photo { position: relative; } +.piece-gallery a.zoom { display: block; border-radius: var(--radius); overflow: hidden; } .piece-gallery picture, .piece-gallery img, .piece-gallery .ph { display: block; width: 100%; aspect-ratio: 1; height: auto; object-fit: cover; border-radius: var(--radius); background: var(--line); } -.piece-gallery.is-sold img { filter: grayscale(.6); opacity: .75; } +.piece-facts { list-style: none; padding: .75rem 1rem; margin: .25rem 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: .3rem; font-size: .92rem; color: var(--muted); } .piece-about { display: grid; align-content: start; gap: .7rem; } .piece-about h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0; } .piece-about p { margin: 0; } diff --git a/site/data/archive.json b/site/data/archive.json index 83cd11e..8b4ce79 100644 --- a/site/data/archive.json +++ b/site/data/archive.json @@ -49,7 +49,7 @@ }, { "image": "images/archive/09.jpg", - "title": "Banded cup", + "title": "Straight-sided banded cup", "description": "Straight-sided cup in dark and green bands.", "alt": "Straight-sided handmade ceramic cup glazed in dark iron and green bands" }, diff --git a/site/data/site.json b/site/data/site.json index e4c037b..41079d9 100644 --- a/site/data/site.json +++ b/site/data/site.json @@ -1,9 +1,3 @@ { - "contactEmail": "aaronfilson@gmail.com", - "banner": { - "text": "Pottery Sale October 24th!", - "linkText": "Event details", - "href": "https://www.facebook.com/events/1090423593838887", - "until": "2026-10-24T16:00:00-07:00" - } + "contactEmail": "aaronfilson@gmail.com" } diff --git a/site/data/work.json b/site/data/work.json index 7b1096f..92502cc 100644 --- a/site/data/work.json +++ b/site/data/work.json @@ -13,8 +13,8 @@ }, { "image": "images/work/03.jpg", - "title": "Lightened stoneware body with lantern motif, mystery glaze with soda flashing, plus a bonus porcelain bowl.", - "description": "Brushed cobalt on stoneware and celadon.", + "title": "Lantern stoneware & porcelain kiln load", + "description": "Lightened stoneware with brushed cobalt lantern motif, soda-flashed mystery glaze, and a porcelain bowl.", "alt": "A tall brown vase, a ribbed jar, a ribbed bowl and three bowls with a blue brushed lantern motif inside a kiln" }, { diff --git a/site/gifts.html b/site/gifts.html new file mode 100644 index 0000000..f504f7b --- /dev/null +++ b/site/gifts.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Handmade Pottery Gifts & 9th Anniversary | Updraft Pottery + + + {{css}} + + + + + +
+ +
+

Handmade pottery gifts

+

+ Every piece from Updraft Pottery Studio is wheel-thrown or hand-built in Tacoma, Washington, and finished one at + a time. Because high-fired porcelain and stoneware are meant to be used daily, handmade pots become part of the + kitchen and table for decades. +

+ +

9th anniversary pottery gifts

+

+ Pottery is the traditional gift for a ninth wedding anniversary, and handmade ceramics mark it naturally. A + serving bowl, a vase for fresh branches, + or a nested set of bowls brings tactile weight and subtle glaze variation—celadon, crackle, tenmoku, or + atmospheric flashing—that cannot be duplicated. +

+ +

Wedding and housewarming ceramics

+

+ For weddings, housewarmings, and milestone dinners, functional serving pieces work in almost any home. Serving + bowls, wide plates and dishes, planters, and flared stoneware vases hold fruit on a counter, anchor a dining table, + or put flowers in the entryway without needing to match an existing dinnerware pattern. +

+ +

Everyday coffee, tea, and table gifts

+

+ Smaller studio pieces—coasters, everyday bowls, and mugs when listed—make approachable gifts for coffee and tea + drinkers. All tableware is fired to cone 6 or cone 10 with lead-free glazes, and is food safe, dishwasher safe, + and microwave safe. Read care & use or explore glaze and firing meanings in + ceramic terms. +

+ +

Packing, US shipping, and Tacoma pickup

+

+ If you are sending a gift across the country, every shipped piece is double boxed with padding in both boxes and + leaves Tacoma within one to two business days, insured against transit damage. Local pickup in Tacoma is free and + can be scheduled {{pickupEmail}}. If you want extra photos, color notes, or a gift message check before buying, + reach out by email—see shipping, pickup & returns. +

+ +

Shop available pieces →

+
+
+ + + diff --git a/site/index.html b/site/index.html index 22d7651..bc0b2ab 100644 --- a/site/index.html +++ b/site/index.html @@ -77,8 +77,8 @@

Recent work

diff --git a/site/js/available.js b/site/js/available.js index f53bed8..57d9ce5 100644 --- a/site/js/available.js +++ b/site/js/available.js @@ -2,7 +2,7 @@ // page. If the shop can't be reached the section is hidden; the hero's Shop button still works. import { getJson } from "./api.js"; import { money } from "./cart.js"; -import { availableNow, fromPrice } from "./shop-logic.js"; +import { availableNow, fromPrice, specLine } from "./shop-logic.js"; import { picture } from "./photos.js"; const SHOW = 4; @@ -12,9 +12,10 @@ const list = document.getElementById("available-list"); /** @param {import("./shop-logic.js").Item} item */ function card(item) { const a = Object.assign(document.createElement("a"), { className: "card product-link", href: `/p/${item.id}` }); + const spec = specLine(item.description); a.append( item.image - ? picture(item.image, { sizes: "(max-width: 599px) 46vw, 260px" }) + ? picture(item.image, { sizes: "(max-width: 599px) 46vw, 260px", alt: spec ? `${item.name} — ${spec}` : item.name }) : Object.assign(document.createElement("div"), { className: "ph" }), ); const body = Object.assign(document.createElement("div"), { className: "card-body" }); diff --git a/site/js/shop-logic.js b/site/js/shop-logic.js index e5a7b61..b0eb083 100644 --- a/site/js/shop-logic.js +++ b/site/js/shop-logic.js @@ -26,15 +26,49 @@ export function reconcile(lines, stockById) { return { lines: kept, gone }; } -/** @typedef {{ id: string, name: string, image?: string | null, variations: { id: string, price: number, stock?: number | null }[] }} Item */ +/** @typedef {{ id: string, name: string, description?: string, category?: string | null, image?: string | null, variations: { id: string, price: number, stock?: number | null }[] }} Item */ /** - * Pieces that can still be bought (any option not sold out; no stock count = no limit), in catalog - * order, at most n. For the home page's "Available now". + * Pieces that can still be bought (any option not sold out; no stock count = no limit), up to n. + * When at least two categories have available pieces, picks round-robin across categories so the + * home page strip shows variety; otherwise preserves catalog order. * @param {Item[]} items * @param {number} n */ -export const availableNow = (items, n) => items.filter((i) => i.variations.some((v) => (v.stock ?? null) !== 0)).slice(0, n); +export function availableNow(items, n) { + const open = items.filter((i) => i.variations.some((v) => (v.stock ?? null) !== 0)); + /** @type {Map} */ + const byCat = new Map(); + /** @type {Item[]} */ + const uncategorized = []; + for (const item of open) { + const cat = /** @type {any} */ (item).category?.trim(); + if (!cat) { + uncategorized.push(item); + continue; + } + if (!byCat.has(cat)) byCat.set(cat, []); + byCat.get(cat).push(item); + } + if (byCat.size < 2) return open.slice(0, n); + const buckets = [...byCat.values()]; + const out = []; + for (let round = 0; out.length < n; round++) { + let added = false; + for (const bucket of buckets) { + if (round < bucket.length && out.length < n) { + out.push(bucket[round]); + added = true; + } + } + if (!added) break; + } + for (const item of uncategorized) { + if (out.length >= n) break; + out.push(item); + } + return out; +} /** The lowest price among a piece's options that aren't sold out, and whether others cost more. @param {Item} item */ export function fromPrice(item) { diff --git a/site/js/shop.js b/site/js/shop.js index 567871d..1329cf6 100644 --- a/site/js/shop.js +++ b/site/js/shop.js @@ -72,11 +72,29 @@ async function renderProducts() { } box.replaceChildren(...items.map(productCard)); renderFilters(items); - // The list of pieces for search engines; each piece's own page has its price and availability. - const existing = document.getElementById("shop-itemlist"); - const data = existing ?? Object.assign(document.createElement("script"), { id: "shop-itemlist", type: "application/ld+json" }); - data.textContent = JSON.stringify(productData(items, location.origin)); - if (!existing) document.head.append(data); + // Keep the head CollectionPage JSON-LD's ItemList in sync without emitting a duplicate script block. + const itemList = { "@type": "ItemList", itemListElement: productData(items, location.origin).itemListElement }; + const headLd = document.querySelector('head script[type="application/ld+json"]:not(#shop-itemlist)'); + let merged = false; + if (headLd?.textContent) { + try { + const parsed = JSON.parse(headLd.textContent); + const pageNode = parsed?.["@graph"]?.find((n) => n["@type"] === "CollectionPage"); + if (pageNode) { + pageNode.mainEntity = itemList; + headLd.textContent = JSON.stringify(parsed); + merged = true; + } + } catch { + /* malformed static block: fall back to dedicated #shop-itemlist */ + } + } + if (!merged) { + const existing = document.getElementById("shop-itemlist"); + const data = existing ?? Object.assign(document.createElement("script"), { id: "shop-itemlist", type: "application/ld+json" }); + data.textContent = JSON.stringify(productData(items, location.origin)); + if (!existing) document.head.append(data); + } openFromHash(); // a link to one piece: /shop.html#p-ITEM } catch { box.innerHTML = '

The shop is unavailable right now. Please try again later.

'; @@ -175,9 +193,11 @@ function productCard(item) { }; const media = Object.assign(document.createElement("a"), { className: "media", href, tabIndex: -1, onclick: openHere }); media.setAttribute("aria-hidden", "true"); + const specText = specLine(item.description); + const alt = specText ? `${item.name} — ${specText}` : item.name; media.append( item.image - ? picture(item.image, { sizes: "(max-width: 599px) 46vw, 300px" }) + ? picture(item.image, { sizes: "(max-width: 599px) 46vw, 300px", alt }) : Object.assign(document.createElement("div"), { className: "ph" }), ); const soldBadge = Object.assign(document.createElement("span"), { className: "sold-badge", textContent: "Sold" }); diff --git a/site/js/site.js b/site/js/site.js index a0badce..dbf9e27 100644 --- a/site/js/site.js +++ b/site/js/site.js @@ -56,7 +56,7 @@ document.addEventListener("click", (e) => { const a = /** @type {HTMLAnchorElement | null} */ (/** @type {Element} */ (e.target).closest("a.zoom")); if (!a || e.metaKey || e.ctrlKey || e.shiftKey) return; e.preventDefault(); - group = [...(a.closest(".gallery") ?? document).querySelectorAll("a.zoom")]; + group = [...(a.closest(".gallery, .piece-gallery") ?? document).querySelectorAll("a.zoom")]; $(".lb-prev").hidden = $(".lb-next").hidden = group.length < 2; show(group.indexOf(a)); dialog.showModal(); diff --git a/site/js/test/seo.test.mjs b/site/js/test/seo.test.mjs index 5cf97d4..2fc547c 100644 --- a/site/js/test/seo.test.mjs +++ b/site/js/test/seo.test.mjs @@ -5,7 +5,17 @@ import path from "node:path"; import { INDEXNOW_KEY, submitIndexNow } from "../../../scripts/indexnow.mjs"; const SITE = path.resolve(import.meta.dirname, "..", ".."); -const PAGES = ["index.html", "shop.html", "past-work.html", "about.html", "kilns.html", "terms.html", "care.html", "policies.html"]; +const PAGES = [ + "index.html", + "shop.html", + "past-work.html", + "about.html", + "kilns.html", + "terms.html", + "care.html", + "policies.html", + "gifts.html", +]; test("every indexable page has one h1, a title <= 60 chars, and a 70-160 char description", async () => { for (const name of PAGES) { diff --git a/site/js/test/shop-logic.test.mjs b/site/js/test/shop-logic.test.mjs index 2c1d5f0..ba289a5 100644 --- a/site/js/test/shop-logic.test.mjs +++ b/site/js/test/shop-logic.test.mjs @@ -67,6 +67,18 @@ test("availableNow keeps pieces with anything left to buy, in order, up to n", a availableNow(items, 3).map((i) => i.id), ["one", "open", "old"], ); + // When two or more categories have open pieces, availableNow selects round-robin across categories. + const multi = [ + { ...piece("b1", [100, 1]), category: "Bowls" }, + { ...piece("b2", [100, 1]), category: "Bowls" }, + { ...piece("b3", [100, 1]), category: "Bowls" }, + { ...piece("v1", [100, 1]), category: "Vases" }, + { ...piece("p1", [100, 1]), category: "Plates" }, + ]; + assert.deepEqual( + availableNow(multi, 4).map((i) => i.id), + ["b1", "v1", "p1", "b2"], + ); assert.deepEqual(fromPrice(piece("m", [3000, null], [5500, 3], [2000, 0])), { price: 3000, varies: true }); assert.deepEqual(fromPrice(piece("s", [6500, 1])), { price: 6500, varies: false }); }); diff --git a/site/kilns.html b/site/kilns.html index f765c8c..9746473 100644 --- a/site/kilns.html +++ b/site/kilns.html @@ -3,7 +3,7 @@ - Soda Kiln & Updraft Kiln Projects | Updraft Pottery + Soda Kiln & Updraft Kiln | Updraft Pottery Studio {{css}} @@ -14,25 +14,64 @@
-
-

Kiln projects

-

The projects I have worked on, mostly kilns.

+
+

Soda kiln & updraft kiln projects

+

+ The kilns behind the work: building a propane updraft kiln in Tacoma and an atmospheric salt and soda kiln in + Covington. Firing with fuel and reactive vapor rather than sealed electricity shapes the clay and glaze in ways + every piece carries out of the kiln. +

+

+ In reduction and soda-fired firings, the + path of the flame across each shelf leaves subtle shifts in iron, carbon, and silica across the pot. Those + variations are why two bowls glazed from the same bucket can come out with completely different surfaces. +

-

The updraft kiln shed

-

A small project to house the propane updraft kiln at my studio in Tacoma.

+

The propane updraft kiln in Tacoma

+
+

+ At Updraft Pottery Studio in Tacoma, I built a small covered kiln shed to house a propane-fired updraft kiln + built from insulating firebrick and strapped in steel. +

+

+ Setting up a gas kiln at the home studio started with a concrete foundation pad, a level firebrick floor with a + central burner port, and a metal exhaust vent hood overhead. Propane plumbing enters at the base, while digital + pyrometer and temperature controllers mounted on the shed wall help track heat work closely through the firing + cycle. +

+

+ Working with an updraft kiln at home means constantly tuning burners, damper drafts, and brickwork—as noted on + the about page, the Tacoma kiln is always evolving through another rebuild to chase + cleaner reduction and even heat from bottom shelf to top. +

+
-

The soda kiln

-

- The project to build and operate a soda kiln at Elinor Maroney's studio in Covington. We have salted the kiln, - which means it will forever be a salt/soda kiln. A wide range of results have been delivered into my hands from - this project. Expensive failures, dull and bland surfaces, falling flaming doors, and ruined pieces have mostly - changed over to exciting textures and dramatic flashes of color. It continues to suffer from being too tall. -

+

The salt and soda kiln in Covington

+
+

+ The project to build and operate a soda kiln at Elinor Maroney's studio in Covington. We have salted the kiln, + which means it will forever be a salt/soda kiln. A wide range of results have been delivered into my hands from + this project. Expensive failures, dull and bland surfaces, falling flaming doors, and ruined pieces have mostly + changed over to exciting textures and dramatic flashes of color. It continues to suffer from being too tall. +

+

+ Early firings meant bricking up the arched doorway by hand with loose firebricks before every firing and tearing + it down again to unload. To make the studio safer and faster to turn around, I designed and welded a freestanding + steel channel support frame with heavy pivot hinges and an arched brick tray that swings open cleanly between + loads. +

+

+ During the peak of the firing, introducing sodium into the chamber creates flashing, warm orange-peel texture, and + glaze pooling where vapor rides the draft. You can see examples of those atmospheric surfaces in + past work and read how to care for soda-fired textures on the + care & use page. +

+

See pieces from the kilns in the shop →

diff --git a/site/partials/footer.html b/site/partials/footer.html index 9ec0d16..021870a 100644 --- a/site/partials/footer.html +++ b/site/partials/footer.html @@ -4,6 +4,7 @@

Updraft Pottery Studio · Tacoma, WA{{contactLine}}

diff --git a/site/shop.html b/site/shop.html index d64f53c..8711d3a 100644 --- a/site/shop.html +++ b/site/shop.html @@ -17,9 +17,8 @@

Shop

-

One-of-a-kind porcelain and stoneware for the table and home, thrown and fired by hand in Tacoma, Washington.

-

Food safe with lead-free glazes, dishwasher and microwave safe. Not for the oven, stovetop or open flame. Care & use

-

Local pickup in Tacoma, or shipping within the US. Orders ship in 1–2 business days. {{policiesShopLink}}

+

One-of-a-kind porcelain and stoneware for the table and home, thrown and fired by hand in Tacoma, Washington. Food safe with lead-free glazes, dishwasher and microwave safe (Care & use · Ceramic terms).

+

Local pickup in Tacoma, or double-boxed US shipping in 1–2 business days. {{policiesShopLink}} · Pottery gifts

Pieces for sale

diff --git a/site/terms.html b/site/terms.html index 76a2dd0..6def43f 100644 --- a/site/terms.html +++ b/site/terms.html @@ -3,7 +3,7 @@ - Pottery & Ceramic Glaze Glossary | Updraft Pottery + Pottery & Glaze Glossary | Updraft Pottery Studio {{css}}