diff --git a/README.md b/README.md index 44c297b..9a01b97 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ The build: Products come straight from your Square catalog. Add items in Square Dashboard > Items & services, with a price and a photo. They appear on the shop within a minute. Shop prices and tax are always calculated by Square on the server. +**Naming & descriptions for search:** Square item names become `/p/` `

` headings and `` tags, and the first line of the Square description becomes the spec line and search snippet. Favor specific, plain-language names (e.g. `"Celadon porcelain mug, 12 oz"` or `"Soda-fired stoneware vase"`) and put clay body, glaze, and dimensions on line 1 (`"Cone 10 stoneware · Tacoma crackle 26 · 9½″ × 3¾″"`). Batch files for `scripts/load-items.mjs` accept optional `clay`, `glaze`, and `description` fields at both the batch and item level. + **Shipping** is priced per piece, from the delivery ZIP: one double-boxed parcel per piece, at the published label price for its billed weight and zone from Tacoma, rounded up to whole dollars (`backend/src/shipping.mjs`). UPS Ground carries everything it can; USPS Ground Advantage takes PO boxes, military addresses, Alaska, Hawaii and the territories. Each item needs a **Ship weight (lb)** custom attribute in Square: the billed weight of the packed box (the larger of actual and dimensional weight, from the pack-and-ship planner). An item without one can be picked up but not shipped. Rates and zones live in `backend/src/shipping-rates.json`; update it when UPS or USPS change prices (USPS holiday prices end 2027-01-17; the UPS fuel surcharge changes weekly). ## Email signup diff --git a/backend/src/catalog.mjs b/backend/src/catalog.mjs index b09632e..fd93f0f 100644 --- a/backend/src/catalog.mjs +++ b/backend/src/catalog.mjs @@ -47,29 +47,33 @@ export async function loadCatalog() { const items = objects .filter((o) => o.type === "ITEM" && !o.isDeleted && o.itemData?.productType !== "APPOINTMENTS_SERVICE") .filter((o) => !o.itemData.isArchived) - .map((o) => ({ - 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 - category: categoryOf(o.itemData), - updatedAt: o.updatedAt ?? null, // the pieces' sitemap (piece-page.mjs) - variations: (o.itemData.variations ?? []) - .filter((v) => v.itemVariationData?.priceMoney) - .map((v) => { - const d = v.itemVariationData; - const here = d.locationOverrides?.find((x) => x.locationId === SQUARE_LOCATION_ID); - const name = o.itemData.variations.length > 1 ? `${o.itemData.name} (${d.name})` : o.itemData.name; - info.set(v.id, { - name, - tracked: Boolean(here?.trackInventory ?? d.trackInventory), - soldOut: Boolean(here?.soldOut), - shipLb: shipLbOf(o), - }); - return { id: v.id, name: d.name, price: Number(d.priceMoney.amount), currency: d.priceMoney.currency }; - }), - })) + .map((o) => { + const shipLb = shipLbOf(o); + 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 + category: categoryOf(o.itemData), + ...(shipLb ? { shipLb } : {}), + updatedAt: o.updatedAt ?? null, // the pieces' sitemap (piece-page.mjs) + variations: (o.itemData.variations ?? []) + .filter((v) => v.itemVariationData?.priceMoney) + .map((v) => { + const d = v.itemVariationData; + const here = d.locationOverrides?.find((x) => x.locationId === SQUARE_LOCATION_ID); + const name = o.itemData.variations.length > 1 ? `${o.itemData.name} (${d.name})` : o.itemData.name; + info.set(v.id, { + name, + tracked: Boolean(here?.trackInventory ?? d.trackInventory), + soldOut: Boolean(here?.soldOut), + shipLb, + }); + return { id: v.id, name: d.name, price: Number(d.priceMoney.amount), currency: d.priceMoney.currency }; + }), + }; + }) .filter((i) => i.variations.length); const counts = await liveStock([...info].filter(([, v]) => v.tracked).map(([id]) => id)); diff --git a/backend/src/piece-page.mjs b/backend/src/piece-page.mjs index 5136335..bc8ffbe 100644 --- a/backend/src/piece-page.mjs +++ b/backend/src/piece-page.mjs @@ -45,6 +45,29 @@ export function metaDescription(item) { return spec ? `${spec}. Handmade in Tacoma by ${SITE_NAME}.` : `Handmade in Tacoma by ${SITE_NAME}.`; } +/** Page <title>, adding "Handmade pottery" when the piece name has room (<= 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; + } + return `${name} | ${SITE_NAME}`; +} + +function materialOf(item) { + const text = `${item.name ?? ""} ${item.description ?? ""}`; + if (/porcelain/i.test(text) && /stoneware/i.test(text)) return "Porcelain and stoneware"; + if (/porcelain/i.test(text)) return "Porcelain"; + if (/stoneware/i.test(text)) return "Stoneware"; + return "Ceramic"; +} + +function photoAlt(item, i) { + const spec = specLine(item.description); + return i === 0 && spec ? `${item.name} — ${spec}` : `${item.name}, photo ${i + 1}`; +} + function picture(url, { alt, sizes, widths, eager }) { const set = (f) => widths.map((w) => `${sized(url, w, f)} ${w}w`).join(", "); // data-original: Square's full-size photo, which piece-page.js shows if the resized one can't load. @@ -59,10 +82,13 @@ function picture(url, { alt, sizes, widths, eager }) { export function structuredData(item, site) { const url = `${site}/p/${item.id}`; const many = item.variations.length > 1; + const delivery = + item.shipLb > 0 ? ["https://schema.org/OnSitePickup", "https://schema.org/ParcelService"] : ["https://schema.org/OnSitePickup"]; const crumbs = [ + { name: "Home", item: `${site}/` }, { name: "Shop", item: `${site}/shop.html` }, ...(item.category ? [{ name: item.category, item: `${site}/shop.html?type=${encodeURIComponent(item.category)}` }] : []), - { name: item.name, item: url }, + { name: item.name }, ]; return { "@context": "https://schema.org", @@ -76,6 +102,10 @@ export function structuredData(item, site) { sku: item.id, image: photosOf(item).map((p) => site + sized(p, 1200, "jpeg")), ...(item.category ? { category: item.category } : {}), + material: materialOf(item), + countryOfOrigin: "US", + ...(item.shipLb > 0 ? { weight: { "@type": "QuantitativeValue", value: item.shipLb, unitCode: "LBR" } } : {}), + creator: { "@type": "Person", "@id": `${site}/about.html#aaron`, name: "Aaron Filson" }, brand: { "@type": "Brand", name: SITE_NAME }, offers: item.variations.map((v) => ({ "@type": "Offer", @@ -85,7 +115,8 @@ export function structuredData(item, site) { priceCurrency: v.currency ?? "USD", availability: isOpen(v) ? "https://schema.org/InStock" : "https://schema.org/SoldOut", itemCondition: "https://schema.org/NewCondition", - seller: { "@type": "Organization", name: SITE_NAME, url: `${site}/` }, + availableDeliveryMethod: delivery, + seller: { "@type": "OnlineStore", "@id": `${site}/#store`, name: SITE_NAME, url: `${site}/` }, // policies.html: returns are not accepted (a piece broken in shipping is refunded). hasMerchantReturnPolicy: { "@type": "MerchantReturnPolicy", @@ -96,6 +127,7 @@ export function structuredData(item, site) { }, { "@type": "BreadcrumbList", + "@id": `${url}#breadcrumb`, itemListElement: crumbs.map((c, n) => ({ "@type": "ListItem", position: n + 1, ...c })), }, ], @@ -115,6 +147,7 @@ function headTags(item, site) { `<meta property="og:description" content="${esc(specLine(item.description) || metaDescription(item))}">`, `<meta property="og:url" content="${esc(url)}">`, `<meta property="og:image" content="${esc(photo ? site + sized(photo, 1200, "jpeg") : `${site}/favicon.svg`)}">`, + `<meta property="og:image:alt" content="${esc(photoAlt(item, 0))}">`, // Read by Facebook and Pinterest for the price on a shared piece. ...(open.length ? [ @@ -147,7 +180,7 @@ function body(item, items, { policies }) { ? photos .map((p, i) => picture(p, { - alt: `${item.name}, photo ${i + 1}`, + alt: photoAlt(item, i), 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 eager: i === 0, @@ -164,7 +197,7 @@ function body(item, items, { policies }) { }; return ( `<div class="wrap piece-page">` + - `<nav class="crumbs" aria-label="Breadcrumb"><ol><li><a href="/shop.html">Shop</a></li>` + + `<nav class="crumbs" aria-label="Breadcrumb"><ol><li><a href="/">Home</a></li><li><a href="/shop.html">Shop</a></li>` + (item.category ? `<li><a href="/shop.html?type=${esc(encodeURIComponent(item.category))}">${esc(item.category)}</a></li>` : "") + `<li><span aria-current="page">${esc(item.name)}</span></li></ol></nav>` + `<div class="piece-layout"><div class="piece-gallery${sold ? " is-sold" : ""}">${gallery}</div>` + @@ -196,7 +229,7 @@ function body(item, items, { policies }) { * site: the address pages are linked from, e.g. https://updraftpotterystudio.com ("" when unknown) */ export function renderPiece({ item, items, shell, site }) { - const title = `${esc(item.name)} | ${SITE_NAME}`; + const title = esc(pieceTitle(item)); if (shell?.includes("[[piece]]")) return shell .replace(/<title>[^<]*<\/title>/, () => `<title>${title}`) @@ -215,10 +248,19 @@ export const gonePage = () => `` + `

That piece isn't listed any more. See what's in the shop.

`; -/** Every listed piece, sold ones too: their pages stay up. */ +/** Every listed piece (sold ones too: their pages stay up), with its 1200px photos for image search. */ export function piecesSitemap(items, site) { - const urls = items.map( - (i) => ` ${esc(`${site}/p/${i.id}`)}${i.updatedAt ? `${esc(i.updatedAt.slice(0, 10))}` : ""}`, + const urls = items.map((i) => { + const loc = `${esc(`${site}/p/${i.id}`)}`; + const lastmod = i.updatedAt ? `${esc(i.updatedAt.slice(0, 10))}` : ""; + const imgs = photosOf(i) + .map((p) => `${esc(site + sized(p, 1200, "jpeg"))}`) + .join(""); + return ` ${loc}${lastmod}${imgs}`; + }); + return ( + `\n` + + `\n` + + `${urls.join("\n")}\n\n` ); - return `\n\n${urls.join("\n")}\n\n`; } diff --git a/backend/test/shop-pages.test.mjs b/backend/test/shop-pages.test.mjs index 9d74680..c47f907 100644 --- a/backend/test/shop-pages.test.mjs +++ b/backend/test/shop-pages.test.mjs @@ -5,7 +5,7 @@ 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 } from "../src/piece-page.mjs"; +import { renderPiece, structuredData, pieceTitle } from "../src/piece-page.mjs"; const SQUARE_PHOTO = "https://items-images-sandbox.s3.us-west-2.amazonaws.com/files/abc/original.jpeg"; @@ -116,7 +116,7 @@ const iter = (arr) => ({ yield* arr; }, }); -function fakeCatalog({ name = "Celadon bowl", description = "Cone 10 porcelain · celadon\nThrown in Tacoma." } = {}) { +function fakeCatalog({ name = "Celadon bowl", description = "Cone 10 porcelain · celadon\nThrown in Tacoma.", shipLb = 14 } = {}) { return { catalog: { list: async () => @@ -128,6 +128,7 @@ function fakeCatalog({ name = "Celadon bowl", description = "Cone 10 porcelain type: "ITEM", id: "I1", updatedAt: "2026-10-15T18:04:00.000Z", + ...(shipLb ? { customAttributeValues: { ship_lb: { key: "ship_lb", numberValue: String(shipLb) } } } : {}), itemData: { name, description, @@ -145,12 +146,13 @@ function fakeCatalog({ name = "Celadon bowl", description = "Cone 10 porcelain } const get = (path) => handler({ requestContext: { http: { method: "GET" } }, rawPath: path }); -test("the catalog lists every photo, in order, and the piece's type", async () => { +test("the catalog lists every photo, in order, the piece's type and its shipping weight", async () => { _setSquare(fakeCatalog()); const { items } = JSON.parse((await get("/api/catalog")).body); assert.equal(items[0].image, SQUARE_PHOTO); assert.deepEqual(items[0].images, [SQUARE_PHOTO, SQUARE_PHOTO.replace("abc", "def")]); assert.equal(items[0].category, "Bowls"); + assert.equal(items[0].shipLb, 14); }); // The JSON-LD block of a page. @@ -166,30 +168,49 @@ test("a piece's page has its name, price, photos, words and product data, and no assert.match(res.body, /

Thrown in Tacoma\.<\/p>/); assert.match(res.body, /

\$65\.00<\/p>/); assert.match(res.body, /Buy in the shop<\/a>/, "works without the script"); + assert.match(res.body, /alt="Celadon bowl — Cone 10 porcelain · celadon"/); assert.match(res.body, /alt="Celadon bowl, photo 2"/); assert.match(res.body, //); assert.match(res.body, //); + assert.match(res.body, //); assert.match( res.body, //, ); assert.match(res.body, //); assert.match(res.body, //); - assert.match(res.body, /Bowls<\/a>/, "breadcrumbs"); + assert.match( + res.body, + /

  • Home<\/a><\/li>
  • Shop<\/a><\/li>
  • Bowls<\/a><\/li>/, + "breadcrumbs", + ); assert.ok(!res.body.includes("p.js"), "no redirect to the shop any more"); const [product, crumbs] = ld(res.body)["@graph"]; assert.equal(product["@type"], "Product"); + assert.equal(product.material, "Porcelain"); + assert.equal(product.countryOfOrigin, "US"); + assert.deepEqual(product.weight, { "@type": "QuantitativeValue", value: 14, unitCode: "LBR" }); assert.equal(product.offers[0].price, "65.00"); assert.equal(product.offers[0].availability, "https://schema.org/InStock"); + assert.deepEqual(product.offers[0].availableDeliveryMethod, ["https://schema.org/OnSitePickup", "https://schema.org/ParcelService"]); assert.equal(product.image.length, 2); assert.deepEqual( crumbs.itemListElement.map((c) => c.name), - ["Shop", "Bowls", "Celadon bowl"], + ["Home", "Shop", "Bowls", "Celadon bowl"], ); + assert.equal(crumbs.itemListElement.at(-1).item, undefined, "current page crumb omits item URL"); const data = JSON.parse(res.body.match(/`); return tags.map((t) => " " + t).join("\n"); } async function page(name, replacements, shared) { let html = await readFile(path.join(SRC, name), "utf8"); html = html.replace("", headMeta(name, html, shared)); + html = html.replace("", crumbsHtml(name)); for (const [k, v] of Object.entries(replacements)) html = html.replaceAll(k, v); const leftover = html.match(/\{\{\w+\}\}|/); if (leftover) throw new Error(`${name}: unreplaced placeholder ${leftover[0]}`); @@ -354,9 +639,18 @@ async function page(name, replacements, shared) { await rm(OUT, { recursive: true, force: true }); await mkdir(OUT, { recursive: true }); -const meta = await images(); -const og = await ogImage(); -const { apple } = await icons(); +const [slugs, workData, archiveData, artistData, kilnShedData, sodaKilnData, termsData] = await Promise.all([ + imageSlugs(), + readData("work.json"), + readData("archive.json"), + readData("artist.json"), + readData("kiln-shed.json"), + readData("soda-kiln.json"), + readData("terms.json"), +]); +const meta = await images(slugs); +const ogs = await ogImages(); +const { apple, icon512 } = await icons(); const assets = await bundle(); const css = await readFile(path.join(OUT, assets.style), "utf8"); await rm(path.join(OUT, assets.style)); // inlined into every page instead @@ -386,7 +680,7 @@ function renderBanner(b, now = Date.now()) { // Site-wide settings. The policy page (and links to it) is only built once a contact email is set, // so a half-finished page can't be published. -const siteData = JSON.parse(await readFile(path.join(SRC, "data", "site.json"), "utf8")); +const siteData = await readData("site.json"); const email = siteData.contactEmail?.trim() ?? ""; if (email && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) throw new Error(`site.json contactEmail looks wrong: ${email}`); const mailto = email ? `${esc(email)}` : ""; @@ -400,7 +694,7 @@ const common = (current, js = assets.site) => ({ "{{css}}": ``, "{{js}}": "/" + js, "{{year}}": String(new Date().getFullYear()), - "{{og}}": SITE_URL + og, + "{{og}}": SITE_URL + ogs.default.url, "{{root}}": SITE_URL + "/", "{{policiesItem}}": email ? '
  • Shipping & returns
  • ' : "", "{{contactLine}}": email ? `
    ${mailto}` : "", @@ -409,7 +703,7 @@ const common = (current, js = assets.site) => ({ "{{contactEmail}}": esc(email), "{{signup}}": signup, // in the footer; the home page places it mid-page instead }); -const shared = { og, apple }; +const shared = { ogs, apple, icon512, email, meta, archive: archiveData, terms: termsData }; const sizes = { "index.html": await page( @@ -455,7 +749,7 @@ const sizes = { }, shared, ), - "terms.html": await page("terms.html", common("/terms.html"), shared), + "terms.html": await page("terms.html", { ...common("/terms.html"), "": termsHtml(termsData) }, shared), "care.html": await page("care.html", common("/care.html"), shared), ...(email ? { "policies.html": await page("policies.html", common("/policies.html"), shared) } : {}), "shop.html": await page("shop.html", common("/shop.html", assets.shop), shared), @@ -463,6 +757,22 @@ const sizes = { [SHELL]: await page(SHELL, common(""), shared), }; +// High-res image URLs per static page for sitemap-pages.xml, so Google Images discovers the 1600px +// gallery photos that otherwise sit behind lightbox links () rather than . +const heroWebp = (img) => meta[img].webp[HERO_WIDTHS.find((w) => meta[img].webp[w]) ?? 400]; +const pageImages = { + "index.html": [ + ...new Set([ + ...workData.map((e) => largestWebp(meta[e.image])), + ...artistData.map((e) => heroWebp(e.image)), + meta["images/soda-kiln/01.jpg"].webp[800] ?? largestWebp(meta["images/soda-kiln/01.jpg"]), + ]), + ], + "about.html": artistData.map((e) => heroWebp(e.image)), + "past-work.html": archiveData.map((e) => largestWebp(meta[e.image])), + "kilns.html": [...kilnShedData, ...sodaKilnData].map((e) => largestWebp(meta[e.image])), +}; + const indexable = Object.keys(sizes).filter((n) => n !== "error.html" && n !== SHELL); await writeFile( path.join(OUT, "robots.txt"), @@ -470,14 +780,18 @@ await writeFile( ? `User-agent: *\nAllow: /\nDisallow: /${SHELL}\n${SITE_URL ? `Sitemap: ${SITE_URL}/sitemap.xml\n` : ""}` : "User-agent: *\nDisallow: /\n", ); // staging stays out of search results -// sitemap.xml names two: this build's pages, and every piece's page, which the API lists from Square -// (/p/sitemap.xml, backend/src/piece.mjs), so a piece listed between publishes is found too. +// sitemap.xml names two: this build's pages (with their high-res gallery photos), and every piece's +// page, which the API lists from Square (/p/sitemap.xml, backend/src/piece.mjs). if (SITE_URL && INDEXABLE) { + const urlEntries = indexable.map((n) => { + const imgs = (pageImages[n] ?? []).map((u) => `\n ${esc(SITE_URL + u)}`).join(""); + return imgs ? ` \n ${esc(pageUrl(n))}${imgs}\n ` : ` ${esc(pageUrl(n))}`; + }); await writeFile( path.join(OUT, "sitemap-pages.xml"), ` - -${indexable.map((n) => ` ${pageUrl(n)}`).join("\n")} + +${urlEntries.join("\n")} `, ); diff --git a/scripts/load-items.mjs b/scripts/load-items.mjs index eb73692..8ced7d5 100644 --- a/scripts/load-items.mjs +++ b/scripts/load-items.mjs @@ -66,7 +66,7 @@ try { console.log(`skip ${it.name} (already in the catalog)`); continue; } - const spec = [it.glaze ?? batch.glaze, it.size].filter(Boolean).join(" · "); + const spec = [it.clay ?? batch.clay, it.glaze ?? batch.glaze, it.size].filter(Boolean).join(" · "); const description = [spec, it.description ?? batch.description].filter(Boolean).join("\n"); console.log( `${GO ? "create" : "would create"} ${it.name} $${it.price} [${it.category}] ship ${it.shipLb} lb ${it.photos.length} photo(s)`, diff --git a/site/about.html b/site/about.html index 787a940..13de640 100644 --- a/site/about.html +++ b/site/about.html @@ -3,8 +3,8 @@ - About the Studio | Updraft Pottery Studio - + About Aaron Filson | Updraft Pottery Studio, Tacoma + {{css}} @@ -13,6 +13,7 @@
    +

    About the studio

    diff --git a/site/care.html b/site/care.html index 4fc8a5b..7377347 100644 --- a/site/care.html +++ b/site/care.html @@ -3,8 +3,8 @@ - Care & Use | Updraft Pottery Studio - + Pottery Care & Use | Updraft Pottery Studio + {{css}} @@ -13,6 +13,7 @@
    +

    Care & use

    Everything I make for the table is meant to be used every day. Here is how to keep it that way.

    @@ -29,12 +30,12 @@

    Food and drink

    My tableware is food safe, and all of my glazes are lead free. Most of my work is stoneware and porcelain fired to cone 10, with some pieces fired to cone 6. Both are fired hot enough to make the clay dense and - durable. If you like the technical side, the ceramic terms page explains cones. + durable. If you like the technical side, the ceramic terms page explains cones.

    Washing

    - Pots are dishwasher safe. Decorative pieces with heavy texture or a soda-fired surface (or both) are best + Pots are dishwasher safe. Decorative pieces with heavy texture or a soda-fired surface (or both) are best washed by hand, which keeps those surfaces looking the way they came out of the kiln.

    @@ -49,7 +50,7 @@

    Keep away from direct heat

    Sudden temperature changes

    - Clay can crack when its temperature changes quickly, which is called thermal shock. Going from cold to hot + Clay can crack when its temperature changes quickly, which is called thermal shock. Going from cold to hot all at once is what to avoid. Let a piece from the freezer or fridge warm up for a bit before you fill it with something boiling hot or put it in the microwave, and don't set a hot pot down on a cold, wet surface.

    diff --git a/site/css/style.css b/site/css/style.css index 8fc0380..36d66fb 100644 --- a/site/css/style.css +++ b/site/css/style.css @@ -247,7 +247,8 @@ body:has(.cart-bar:not([hidden])) footer { padding-bottom: 5.5rem; } /* so the b [hidden] { display: none !important; } .page-title { font-size: clamp(2rem, 6vw, 3rem); } -main > section + section, .hero + section { padding-top: 0; } /* consecutive sections: one gap, not two */ +main > .crumbs { padding-top: 1.25rem; } +main > .crumbs + section, main > section + section, .hero + section { padding-top: 0; } /* consecutive sections: one gap, not two */ .panel-title { font-size: 1.5rem; } .muted { color: var(--muted); } .wide { width: 100%; } @@ -331,7 +332,7 @@ footer p { margin: 0; } .footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; } @media print { - .sale-banner, .site-header nav, .skip, .footer-links, #cart, .cart-bar { display: none; } + .sale-banner, .site-header nav, .crumbs, .skip, .footer-links, #cart, .cart-bar { display: none; } .site-header { position: static; backdrop-filter: none; } .card { box-shadow: none; break-inside: avoid; } } diff --git a/site/data/terms.json b/site/data/terms.json new file mode 100644 index 0000000..85f2b5f --- /dev/null +++ b/site/data/terms.json @@ -0,0 +1,110 @@ +[ + { + "id": "high-fired", + "term": "High fired", + "definition": "The temperature range of around 2250 to 2400 degrees Fahrenheit. Cone 10, where most of my work is fired, is in this range." + }, + { + "id": "mid-range", + "term": "Mid-range", + "definition": "The temperature range of around 2100 to 2250 degrees Fahrenheit, usually called cone 6. Some of my work is fired here. With the right clay and glazes it makes durable, food-safe tableware too." + }, + { + "id": "low-fired", + "term": "Low fired", + "definition": "The wide temperature range of around 1400 to 2000 degrees Fahrenheit." + }, + { + "id": "cone", + "term": "Cone", + "definition": "Potters and ceramists often say that something is fired to cone 10. The cone system is a measurement of both heat and time: a small cone that softens and bends at a chemically reliable point. This lets the person firing the kiln see how much heat work has been done to the ware.", + "link": { + "before": "For more, see the ", + "text": "Orton Ceramic website", + "href": "https://www.ortonceramic.com/pyrometric-cones", + "after": "." + } + }, + { + "id": "reduction", + "term": "Reduction", + "definition": "A kiln atmosphere lacking the oxygen to burn the fuel completely. This causes the fuel to react with the oxygen in the glaze and clay." + }, + { + "id": "oxidation", + "term": "Oxidation", + "definition": "A kiln atmosphere with ample oxygen to burn the fuel. This is typical of electric kilns. Ware fired in oxidation is typically lighter in color than in reduction." + }, + { + "id": "porcelain", + "term": "Porcelain", + "definition": "Clay that is generally white to grey and develops a strong, tight body when fired. Natural porcelain is typically high fired." + }, + { + "id": "stoneware", + "term": "Stoneware", + "definition": "Clay that is generally tan to brown, with the color coming from natural metals and minerals. Most natural stoneware is high fired." + }, + { + "id": "kiln", + "term": "Kiln", + "definition": "Pronounced both \"kill\" and \"kiln\", this is a structure that can withstand high temperatures for long periods, used to fire clay and turn it into ceramics." + }, + { + "id": "glaze", + "term": "Glaze", + "definition": "A layer added to a ceramic piece for durability, looks, or function. The glaze over the clay is often glassy and very strong." + }, + { + "id": "vitrified", + "term": "Vitrified", + "definition": "Clay fired until it is dense and partly glassy, so it no longer soaks up water. Stoneware and porcelain fired to cone 10 are vitrified, which is a big part of why they are so durable." + }, + { + "id": "food-safe", + "term": "Food safe", + "definition": "Describes a glaze that, properly mixed and fired, will not release harmful amounts of metals into food or drink. All of my glazes are lead free.", + "link": { + "before": "See ", + "text": "care & use", + "href": "/care.html", + "after": " for how to look after your pots." + } + }, + { + "id": "thermal-shock", + "term": "Thermal shock", + "definition": "Cracking caused by a sudden change in temperature, like filling a frozen mug with boiling water. Clay handles slow changes well and fast ones badly." + }, + { + "id": "shino", + "term": "Shino", + "definition": "A glaze that came from Japan, usually white to red. It is highly varied, and the kiln atmosphere is very important to how the color turns out. Shino glazes are high fired." + }, + { + "id": "celadon", + "term": "Celadon", + "definition": "A glaze that came from China, Korea, and Japan, typically a shade of green. There are also blue, clear, and white celadons. Most celadons are high fired in reduction." + }, + { + "id": "raku", + "term": "Raku", + "definition": "A style of firing developed in Japan for the tea ceremony. The ware is low fired, and historically under-fired to have a softer feel and sound, which generally means raku ware is not food safe by modern standards. American-style raku is mostly decorative and uses a post-firing reduction to create lustrous metallic glazes and deep blacks." + }, + { + "id": "soda-fired", + "term": "Soda fired", + "definition": "A firing where the ware is glazed by introducing baking soda or soda ash at high temperature. This coats the whole interior of the kiln with sodium, which is very reactive at high temperatures, so the kiln must be specially prepared or the bricks will be eaten away. Soda firing came from a search for an alternative to salt firing, which uses similar methods but has a different look and behavior.", + "link": { + "before": "See the ", + "text": "soda kiln project", + "href": "/kilns.html#soda-kiln", + "after": "." + } + }, + { + "id": "tenmoku", + "term": "Tenmoku (temmoku)", + "definition": "A glaze that is dark brown to black in most cases, named by Japanese tea masters for tea bowls (chawan) from the Mountain of Heaven area in China. Most of my tenmokus are fired in reduction, but some tenmoku glazes only work in oxidation." + } +] diff --git a/site/index.html b/site/index.html index 07a55d1..f6b85da 100644 --- a/site/index.html +++ b/site/index.html @@ -3,22 +3,9 @@ - Updraft Pottery Studio | Handmade ceramics in Tacoma - + Updraft Pottery Studio | Handmade Pottery in Tacoma, WA + - {{css}} diff --git a/site/js/available.js b/site/js/available.js index 713f19b..f53bed8 100644 --- a/site/js/available.js +++ b/site/js/available.js @@ -1,5 +1,5 @@ -// Home page "Available now": the first few pieces still for sale, each linking to its card in the -// shop. If the shop can't be reached the section is hidden; the hero's Shop button still works. +// Home page "Available now": the first few pieces still for sale, each linking to its own /p/ +// 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"; @@ -11,7 +11,7 @@ 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: `/shop.html#p-${item.id}` }); + const a = Object.assign(document.createElement("a"), { className: "card product-link", href: `/p/${item.id}` }); a.append( item.image ? picture(item.image, { sizes: "(max-width: 599px) 46vw, 260px" }) diff --git a/site/js/piece-page.js b/site/js/piece-page.js index ca84171..5372508 100644 --- a/site/js/piece-page.js +++ b/site/js/piece-page.js @@ -4,6 +4,7 @@ // in the shop (photos.js), before falling back to Square's own. import { addToCart, getCart, cartCount, money } from "./cart.js"; import { picture, RETRY_MS } from "./photos.js"; +import { sharePiece } from "./share.js"; /** @typedef {{ id: string, name: string, price: number, currency?: string, stock: number | null }} Variation */ const dataEl = document.getElementById("piece-data"); @@ -35,6 +36,21 @@ for (const img of /** @type {NodeListOf} */ (document.querySel const inCart = (/** @type {string} */ id) => getCart().find((l) => l.variationId === id)?.quantity ?? 0; +// Progressive Share button beside Care & use (works on sold pieces too; omitted when JS is off). +const more = document.querySelector(".piece-page .piece-more"); +if (piece && more) { + const shareBtn = Object.assign(document.createElement("button"), { + type: "button", + className: "link-btn piece-share", + textContent: "Share this piece", + }); + const shared = Object.assign(document.createElement("p"), { className: "piece-shared" }); + shared.setAttribute("role", "status"); + shareBtn.addEventListener("click", () => sharePiece(piece, shared)); + more.prepend(shareBtn); + more.after(shared); +} + if (piece && box && piece.variations.some((v) => v.stock !== 0)) { const many = piece.variations.length > 1; const sel = document.createElement("select"); diff --git a/site/js/piece-view.js b/site/js/piece-view.js index f6a7ebe..8cbf8df 100644 --- a/site/js/piece-view.js +++ b/site/js/piece-view.js @@ -3,6 +3,7 @@ // home page, a click on a card, and the back button). A shared /p/ITEM link is the piece's own page. import { picture } from "./photos.js"; import { specLine, descriptionRest } from "./shop-logic.js"; +import { sharePiece } from "./share.js"; /** * @param {{ buyControls: (item: any) => { sel: HTMLElement, row: HTMLElement, dispose: () => void }, onClose: (item: any) => void }} deps @@ -88,23 +89,7 @@ export function createPieceView({ buyControls, onClose }) { }); // Phones get the system share sheet; elsewhere the link is copied (and shown, in case copying is blocked). - $(".piece-share").addEventListener("click", async () => { - const url = `${location.origin}/p/${encodeURIComponent(item.id)}`; - if (navigator.share) { - try { - await navigator.share({ title: item.name, url }); - return; - } catch (err) { - if (err.name === "AbortError") return; - } - } - try { - await navigator.clipboard.writeText(url); - $(".piece-shared").textContent = `Link copied: ${url}`; - } catch { - $(".piece-shared").textContent = `Link to share: ${url}`; - } - }); + $(".piece-share").addEventListener("click", () => sharePiece(item, $(".piece-shared"))); dialog.addEventListener("close", () => { controls?.dispose(); diff --git a/site/js/share.js b/site/js/share.js new file mode 100644 index 0000000..1d81961 --- /dev/null +++ b/site/js/share.js @@ -0,0 +1,22 @@ +// Shares a piece's /p/ page: native share sheet on phones, clipboard copy (or visible URL) elsewhere. +/** + * @param {{ id: string, name: string }} item + * @param {HTMLElement} statusEl + */ +export async function sharePiece(item, statusEl) { + const url = `${location.origin}/p/${encodeURIComponent(item.id)}`; + if (navigator.share) { + try { + await navigator.share({ title: item.name, url }); + return; + } catch (err) { + if (err.name === "AbortError") return; + } + } + try { + await navigator.clipboard.writeText(url); + statusEl.textContent = `Link copied: ${url}`; + } catch { + statusEl.textContent = `Link to share: ${url}`; + } +} diff --git a/site/js/shop-logic.js b/site/js/shop-logic.js index 2edf1fe..e5a7b61 100644 --- a/site/js/shop-logic.js +++ b/site/js/shop-logic.js @@ -66,8 +66,17 @@ export function typeCounts(items) { return [...counts].map(([name, count]) => ({ name, count })).sort((a, b) => b.count - a.count || a.name.localeCompare(b.name)); } -/** Show type filters only with at least FILTER_MIN_PIECES pieces in two or more types. @param {any[]} items */ -export const showTypeFilters = (items) => items.length >= FILTER_MIN_PIECES && typeCounts(items).length >= 2; +/** + * Show type filters with at least FILTER_MIN_PIECES pieces in two or more types, or whenever the + * URL already asks for a known type (e.g. from a piece page's category breadcrumb). + * @param {any[]} items + * @param {string} [requestedType] + */ +export function showTypeFilters(items, requestedType = "") { + const types = typeCounts(items); + if (requestedType && types.some((t) => t.name === requestedType)) return true; + return items.length >= FILTER_MIN_PIECES && types.length >= 2; +} /** * schema.org list of the shop's pieces, each by its own page (/p/ITEM), which carries the piece's diff --git a/site/js/shop.js b/site/js/shop.js index 54d751c..9f5012a 100644 --- a/site/js/shop.js +++ b/site/js/shop.js @@ -235,8 +235,8 @@ window.addEventListener("hashchange", () => openFromHash(true)); // ---- browse by type (Square categories), once there are enough pieces ------------------------ function renderFilters(list) { const bar = $("#filters"); - if (!showTypeFilters(list)) return; const want = new URLSearchParams(location.search).get("type") ?? ""; + if (!showTypeFilters(list, want)) return; const types = typeCounts(list); let current = types.some((t) => t.name === want) ? want : ""; const options = [{ name: "", label: `All (${list.length})` }, ...types.map((t) => ({ name: t.name, label: `${t.name} (${t.count})` }))]; diff --git a/site/js/test/seo.test.mjs b/site/js/test/seo.test.mjs new file mode 100644 index 0000000..ddb72c2 --- /dev/null +++ b/site/js/test/seo.test.mjs @@ -0,0 +1,35 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import path from "node:path"; + +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"]; + +test("every indexable page has one h1, a title <= 60 chars, and a 70-160 char description", async () => { + for (const name of PAGES) { + const html = await readFile(path.join(SITE, name), "utf8"); + const title = (html.match(/(.*?)<\/title>/)?.[1] ?? "").replaceAll("&", "&"); + const desc = (html.match(/<meta name="description" content="([^"]*)"/)?.[1] ?? "").replaceAll("&", "&"); + const h1s = html.match(/<h1\b/g) ?? []; + assert.equal(h1s.length, 1, `${name}: expected one <h1>`); + assert.ok(title.length >= 20 && title.length <= 60, `${name}: title length ${title.length} ("${title}")`); + assert.ok(desc.length >= 70 && desc.length <= 160, `${name}: description length ${desc.length}`); + if (name !== "index.html") assert.ok(html.includes("<!--crumbs-->"), `${name}: missing <!--crumbs--> placeholder`); + } +}); + +test("every term in terms.json has a unique anchor id and valid link", async () => { + const terms = JSON.parse(await readFile(path.join(SITE, "data", "terms.json"), "utf8")); + assert.ok(terms.length >= 18); + const ids = terms.map((t) => t.id); + assert.ok( + ids.every((id) => /^[a-z0-9-]+$/.test(id)), + "every term must have a lowercase kebab-case id", + ); + assert.equal(new Set(ids).size, ids.length, "duplicate term id in terms.json"); + for (const t of terms) { + assert.ok(t.term?.trim() && t.definition?.trim(), `${t.id}: missing term or definition`); + if (t.link) assert.match(t.link.href, /^(https:\/\/|\/)/, `${t.id}: invalid link href`); + } +}); diff --git a/site/js/test/shop-logic.test.mjs b/site/js/test/shop-logic.test.mjs index c99254d..2c1d5f0 100644 --- a/site/js/test/shop-logic.test.mjs +++ b/site/js/test/shop-logic.test.mjs @@ -87,6 +87,8 @@ test("spec line, the rest of the description, type filters and product data", as }); const few = [piece("a", "Bowls"), piece("b", "Mugs")]; assert.equal(showTypeFilters(few), false); // too few pieces to need filters + assert.equal(showTypeFilters(few, "Bowls"), true); // unless a link (e.g. breadcrumb) already asked for a type + assert.equal(showTypeFilters(few, "Platters"), false); // unknown type stays ignored const many = Array.from({ length: FILTER_MIN_PIECES }, (_, n) => piece(`p${n}`, n % 3 ? "Mugs" : "Bowls")); assert.equal(showTypeFilters(many), true); assert.equal(showTypeFilters(many.map((p) => ({ ...p, category: "Mugs" }))), false); // one type: nothing to filter diff --git a/site/kilns.html b/site/kilns.html index a750f8e..f765c8c 100644 --- a/site/kilns.html +++ b/site/kilns.html @@ -3,8 +3,8 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>Kiln Projects | Updraft Pottery Studio - + Soda Kiln & Updraft Kiln Projects | Updraft Pottery + {{css}} @@ -13,6 +13,7 @@
    +

    Kiln projects

    The projects I have worked on, mostly kilns.

    @@ -33,6 +34,7 @@

    The soda kiln

    changed over to exciting textures and dramatic flashes of color. It continues to suffer from being too tall.

    +

    See pieces from the kilns in the shop →

    diff --git a/site/past-work.html b/site/past-work.html index 5a67b70..6be0af3 100644 --- a/site/past-work.html +++ b/site/past-work.html @@ -3,8 +3,8 @@ - Past Work | Updraft Pottery Studio - + Past Pottery & Ceramic Art | Updraft Pottery Studio + {{css}} @@ -13,6 +13,7 @@
    +

    Past work

    @@ -20,6 +21,7 @@

    Past work

    and thematic choices have moved over the years.

    +

    See pieces available now in the shop →

    diff --git a/site/policies.html b/site/policies.html index 41aab21..af8e062 100644 --- a/site/policies.html +++ b/site/policies.html @@ -13,6 +13,7 @@
    +

    Shipping, pickup & returns

    How your order gets to you, and what happens if something goes wrong on the way.

    diff --git a/site/shop.html b/site/shop.html index ce04976..8b08deb 100644 --- a/site/shop.html +++ b/site/shop.html @@ -3,8 +3,8 @@ - Shop | Updraft Pottery Studio - + Shop Handmade Pottery | Updraft Pottery Studio + {{css}} @@ -14,8 +14,10 @@
    +

    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}}

    diff --git a/site/terms.html b/site/terms.html index 98ba99d..76a2dd0 100644 --- a/site/terms.html +++ b/site/terms.html @@ -3,8 +3,8 @@ - Ceramic Terms | Updraft Pottery Studio - + Pottery & Ceramic Glaze Glossary | Updraft Pottery + {{css}} @@ -13,122 +13,15 @@
    +

    Ceramic terms

    People are often interested in ceramics and pottery but confused by the terms used. Here is a short list of common terms and methods.

    -
    -
    High fired
    -
    The temperature range of around 2250 to 2400 degrees Fahrenheit. Cone 10, where most of my work is fired, is in this range.
    - -
    Mid-range
    -
    - The temperature range of around 2100 to 2250 degrees Fahrenheit, usually called cone 6. Some of my work is - fired here. With the right clay and glazes it makes durable, food-safe tableware too. -
    - -
    Low fired
    -
    The wide temperature range of around 1400 to 2000 degrees Fahrenheit.
    - -
    Cone
    -
    - Potters and ceramists often say that something is fired to cone 10. The cone system is a measurement of both - heat and time: a small cone that softens and bends at a chemically reliable point. This lets the person firing - the kiln see how much heat work has been done to the ware. For more, see the - Orton Ceramic website. -
    - -
    Reduction
    -
    - A kiln atmosphere lacking the oxygen to burn the fuel completely. This causes the fuel to react with the oxygen - in the glaze and clay. -
    - -
    Oxidation
    -
    - A kiln atmosphere with ample oxygen to burn the fuel. This is typical of electric kilns. Ware fired in oxidation - is typically lighter in color than in reduction. -
    - -
    Porcelain
    -
    - Clay that is generally white to grey and develops a strong, tight body when fired. Natural porcelain is - typically high fired. -
    - -
    Stoneware
    -
    - Clay that is generally tan to brown, with the color coming from natural metals and minerals. Most natural - stoneware is high fired. -
    - -
    Kiln
    -
    - Pronounced both "kill" and "kiln", this is a structure that can withstand high temperatures for long periods, - used to fire clay and turn it into ceramics. -
    - -
    Glaze
    -
    - A layer added to a ceramic piece for durability, looks, or function. The glaze over the clay is often glassy and - very strong. -
    - -
    Vitrified
    -
    - Clay fired until it is dense and partly glassy, so it no longer soaks up water. Stoneware and porcelain - fired to cone 10 are vitrified, which is a big part of why they are so durable. -
    - -
    Food safe
    -
    - Describes a glaze that, properly mixed and fired, will not release harmful amounts of metals into food or - drink. All of my glazes are lead free. See care & use for how to look after - your pots. -
    - -
    Thermal shock
    -
    - Cracking caused by a sudden change in temperature, like filling a frozen mug with boiling water. Clay - handles slow changes well and fast ones badly. -
    - -
    Shino
    -
    - A glaze that came from Japan, usually white to red. It is highly varied, and the kiln atmosphere is very - important to how the color turns out. Shino glazes are high fired. -
    - -
    Celadon
    -
    - A glaze that came from China, Korea, and Japan, typically a shade of green. There are also blue, clear, and white - celadons. Most celadons are high fired in reduction. -
    - -
    Raku
    -
    - A style of firing developed in Japan for the tea ceremony. The ware is low fired, and historically under-fired to - have a softer feel and sound, which generally means raku ware is not food safe by modern standards. American-style - raku is mostly decorative and uses a post-firing reduction to create lustrous metallic glazes and deep blacks. -
    - -
    Soda fired
    -
    - A firing where the ware is glazed by introducing baking soda or soda ash at high temperature. This coats the whole - interior of the kiln with sodium, which is very reactive at high temperatures, so the kiln must be specially - prepared or the bricks will be eaten away. Soda firing came from a search for an alternative to salt firing, which - uses similar methods but has a different look and behavior. See the soda kiln project. -
    - -
    Tenmoku (temmoku)
    -
    - A glaze that is dark brown to black in most cases, named by Japanese tea masters for tea bowls (chawan) from the - Mountain of Heaven area in China. Most of my tenmokus are fired in reduction, but some tenmoku glazes only work in - oxidation. -
    -
    + +

    Browse handmade pieces in the shop →