diff --git a/functions/go/[code].ts b/functions/go/[code].ts index c5091e7..754b1a2 100644 --- a/functions/go/[code].ts +++ b/functions/go/[code].ts @@ -1,5 +1,6 @@ /** - * GET /go/etsy-p01/ … /go/etsy-p05/ and /go/etsy-shop/?page= + * GET /go/etsy-p01/ … /go/etsy-p05/, /go/etsy-p03-uk|us|nz|ca/, + * /go/etsy-starter-scripts/, and /go/etsy-shop/?page= * * Click-through to an Etsy listing. Returns a real 200 HTML page (so Cloudflare Web * Analytics counts it as a pageview), then sends the browser on with a meta refresh @@ -12,7 +13,7 @@ * noindex, no-store (the destination depends on page), and not in the sitemap. * Nothing is stored. No KV, no PII. */ -import { listingDestination, sanitiseCoupon, shopDestination, type EtsyCode } from '../../src/config'; +import { etsyListings, listingDestination, sanitiseCoupon, shopDestination, type EtsyCode } from '../../src/config'; import { couponForHop } from '../../src/lib/bfcm-window'; type Ctx = { request: Request; params: { code?: string | string[] } }; @@ -74,11 +75,12 @@ export const onRequestGet = async ({ request, params }: Ctx): Promise dest = shopDestination(pageSlug, coupon); kind = 'shop'; } else { - const m = /^etsy-(p0[1-5])$/.exec(raw ?? ''); - if (!m) { + const m = /^etsy-([a-z0-9]+(?:-[a-z0-9]+)*)$/.exec(raw ?? ''); + const code = m?.[1]; + if (!code || !(code in etsyListings)) { return new Response('Not found', { status: 404, headers: { 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' } }); } - dest = listingDestination(m[1] as EtsyCode, pageSlug, coupon); + dest = listingDestination(code as EtsyCode, pageSlug, coupon); } return new Response(page(dest, kind), { status: 200, diff --git a/public/llms.txt b/public/llms.txt index e5fd150..344db30 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -5,7 +5,7 @@ The Digital Kitbag team Contact: support@thedigitalkitbag.com Site: https://thedigitalkitbag.com -Etsy shop: https://www.etsy.com/shop/TheDigitalKitbag +Etsy shop: https://thedigitalkitbag.etsy.com/ This file is a map of the live site. Prefer the linked pages for the full wording, figures and official sources. Where a page cites the ATO, business.gov.au, Fair Work or a state regulator, use those official pages as the authority, not this summary. Figures and rules change; check the linked official source and the date on the page. diff --git a/scripts/check-dist.mjs b/scripts/check-dist.mjs index 8c5eb3a..59749e8 100644 --- a/scripts/check-dist.mjs +++ b/scripts/check-dist.mjs @@ -147,11 +147,10 @@ if (!article2.includes('"@type":"Article"') && !article2.includes('"@type": "Art for (const file of htmlFiles) { const html = read(file); const withoutLd = html.replace(/]*type=["']application\/ld\+json["'][^>]*>[\s\S]*?<\/script>/gi, ''); - // Batch 5 articles use the plain Etsy listing URL as written. - if ( - !/blog\/(card-merchant-fees-australia|selling-before-gst-registered)\/index\.html$/.test(file) && - /etsy\.com\/(au\/)?listing\//.test(withoutLd) - ) throw new Error(`Raw Etsy listing link in ${file}`); + if (/etsy\.com\/(au\/)?listing\//.test(withoutLd)) throw new Error(`Raw Etsy listing link in ${file}`); + if (/www\.etsy\.com\/shop\//.test(withoutLd) || /https:\/\/etsy\.shop\b/.test(withoutLd)) { + throw new Error(`Raw Etsy shop link in ${file}`); + } for (const m of html.matchAll(/]*)>/g)) { const attrs = m[1]; if (!/\bsrc=/.test(attrs) && !/application\/ld\+json/.test(attrs)) throw new Error(`Inline script in ${file}`); @@ -952,3 +951,24 @@ for (const [file, questions] of Object.entries(faqExpect)) { if (count < 2) throw new Error(`${file} FAQ ${q} should appear in the visible copy and in JSON-LD`); } } + +// --- fix19: Share & Save hop bypasses; JSON-LD offers stay on www.etsy.com --- +const faqHtml = read(join(dist, 'faq/index.html')); +if (!faqHtml.includes('/go/etsy-shop/?page=faq')) { + throw new Error('FAQ Shop on Etsy link must use etsyShopGoHref(\'faq\')'); +} +const cardFees = read(join(dist, 'blog/card-merchant-fees-australia/index.html')); +if (!cardFees.includes('/go/etsy-p05/?page=card-merchant-fees-australia')) { + throw new Error('card-merchant-fees article must hop via /go/etsy-p05/'); +} +const sellingGst = read(join(dist, 'blog/selling-before-gst-registered/index.html')); +if (!sellingGst.includes('/go/etsy-p05/?page=selling-before-gst-registered')) { + throw new Error('selling-before-gst-registered article must hop via /go/etsy-p05/'); +} +const llmsFix19 = read(join(dist, 'llms.txt')); +if (!llmsFix19.includes('https://thedigitalkitbag.etsy.com/')) { + throw new Error('llms.txt should list the Share & Save shop URL'); +} +if (/www\.etsy\.com\/shop\/TheDigitalKitbag/.test(llmsFix19)) { + throw new Error('llms.txt should not still use the www.etsy.com shop URL'); +} diff --git a/scripts/test-go.ts b/scripts/test-go.ts index 303fce4..f50a693 100644 --- a/scripts/test-go.ts +++ b/scripts/test-go.ts @@ -19,9 +19,45 @@ assert.equal(noCoupon.searchParams.get('ref'), 'site-home'); const listing = new URL(listingDestination('p02', 'em-bas-3', sanitiseCoupon(null))); assert.equal(listing.searchParams.get('utm_content'), 'p02'); assert.equal(listing.searchParams.get('coupon'), null); -assert.match(listing.href, /etsy\.com\/listing\//); +assert.match(listing.href, /^https:\/\/thedigitalkitbag\.etsy\.com\/listing\//); const partner = new URL(listingDestination('p05', 'x', sanitiseCoupon('partner20'))); assert.equal(partner.searchParams.get('coupon'), 'PARTNER20'); +const p01 = new URL(listingDestination('p01', 'home', sanitiseCoupon('BFCM15'))); +assert.equal( + p01.origin + p01.pathname, + 'https://thedigitalkitbag.etsy.com/listing/4619115309/charge-out-rate-calculator-australia-job', +); +assert.equal(p01.searchParams.get('ref'), 'site-home'); +assert.equal(p01.searchParams.get('utm_source'), 'thedigitalkitbag'); +assert.equal(p01.searchParams.get('coupon'), 'BFCM15'); +assert.doesNotMatch(p01.pathname, /\/au\//); + +const p05Hop = new URL(listingDestination('p05', 'x', sanitiseCoupon('BFCM15'))); +assert.equal( + p05Hop.origin + p05Hop.pathname, + 'https://thedigitalkitbag.etsy.com/listing/4619178823/full-kitbag-bundle-australia-charge-out', +); +assert.doesNotMatch(p05Hop.pathname, /\/au\//); +assert.equal(p05Hop.searchParams.get('coupon'), 'BFCM15'); + +const extras: Record = { + 'p03-uk': 'https://thedigitalkitbag.etsy.com/listing/4624460491/invoice-and-quote-templates-uk-vat-and', + 'p03-us': 'https://thedigitalkitbag.etsy.com/listing/4624461397/contractor-invoice-and-estimate', + 'p03-nz': 'https://thedigitalkitbag.etsy.com/listing/4624466664/tax-invoice-and-quote-templates-nz-gst', + 'p03-ca': 'https://thedigitalkitbag.etsy.com/listing/4624462711/contractor-invoice-templates-canada-gst', + 'starter-scripts': + 'https://thedigitalkitbag.etsy.com/listing/4624968342/payment-reminder-scripts-australia-email', +}; +for (const [code, base] of Object.entries(extras)) { + const dest = new URL(listingDestination(code as Parameters[0], 'test-page', sanitiseCoupon('BFCM15'))); + assert.equal(dest.origin + dest.pathname, base); + assert.equal(dest.searchParams.get('ref'), 'site-test-page'); + assert.equal(dest.searchParams.get('utm_campaign'), 'test-page'); + assert.equal(dest.searchParams.get('utm_content'), code); + assert.equal(dest.searchParams.get('coupon'), 'BFCM15'); +} + + console.log('go hop checks passed'); diff --git a/scripts/test-tagged-links.ts b/scripts/test-tagged-links.ts index 6bc5c4f..c9951ac 100644 --- a/scripts/test-tagged-links.ts +++ b/scripts/test-tagged-links.ts @@ -27,7 +27,7 @@ assert.equal(taggedDestination('a'.repeat(41)), null); // Query strings on the request are not part of the code and cannot retarget it. assert.equal(taggedDestination('ig-bio?dest=https://evil.example'), null); -assert.equal(Object.keys(taggedRoutes).length, 293); +assert.equal(Object.keys(taggedRoutes).length, 300); for (const [code, dest] of Object.entries(taggedRoutes)) { assert.match(code, /^[a-z0-9-]{1,40}$/); assert.equal(isSameSitePath(dest), true, `${code} destination must be same-site`); @@ -74,6 +74,8 @@ assert.equal(taggedDestination('pt-tastafe'), '/'); assert.equal(taggedDestination('pt-lincoln-sentry'), '/'); assert.equal(taggedDestination('pt-my-great-bookkeeper'), '/'); assert.equal(taggedDestination('pt-migas'), '/'); +assert.equal(taggedDestination('pt-cdu-plumbing'), '/'); +assert.equal(taggedDestination('pt-tiv'), '/'); assert.equal(taggedDestination('pt-csq'), null); assert.equal(taggedDestination('pt-vacc'), null); assert.equal(taggedDestination('pt-tools-warehouse'), null); diff --git a/src/config.ts b/src/config.ts index bc9442f..f97b3fe 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,9 +8,12 @@ export const brandAssetVersion = '20261117b'; export const etsy = { - shop: 'https://www.etsy.com/shop/TheDigitalKitbag', + shop: 'https://thedigitalkitbag.etsy.com/', /** Shop hop used by /go/etsy-shop/. */ - shopHop: 'https://thedigitalkitbag.etsy.com', + shopHop: 'https://thedigitalkitbag.etsy.com/', + // Canonical www.etsy.com listing URLs used in Product JSON-LD offers.url. + // Share & Save hop bases live in etsyListings: thedigitalkitbag.etsy.com + // 301s to www.etsy.com with ?etsrc=sdt, and GMC can disapprove a redirecting landing page. chargeOutRateCalculator: 'https://www.etsy.com/listing/4619115309/charge-out-rate-calculator-australia-job', gettingPaidKit: 'https://www.etsy.com/listing/4619124012/quote-and-invoice-templates-australia', @@ -22,16 +25,22 @@ export const etsy = { } as const; /** - * Listing codes used by the /go/etsy-p0x/ click-through pages (functions/go/[code].ts). - * The canonical listing URLs above are the destinations; call sites link to etsyGoHref() - * so the visit is counted by Web Analytics and Etsy sees ref=site- plus UTM tags. + * Listing codes used by the /go/etsy-* click-through pages (functions/go/[code].ts). + * These are Share & Save bases (thedigitalkitbag.etsy.com, no /au/). etsyHopUrl() + * still adds ref=site-, UTM tags, and an allowlisted coupon. */ export const etsyListings = { - p01: etsy.chargeOutRateCalculator, - p02: etsy.basGstWorkbook, - p03: etsy.gettingPaidKit, - p04: etsy.subcontractorCompliancePack, - p05: etsy.fullKitbagBundle, + p01: 'https://thedigitalkitbag.etsy.com/listing/4619115309/charge-out-rate-calculator-australia-job', + p02: 'https://thedigitalkitbag.etsy.com/listing/4619166150/bas-and-gst-workbook-australia-quarterly', + p03: 'https://thedigitalkitbag.etsy.com/listing/4619124012/quote-and-invoice-templates-australia', + p04: 'https://thedigitalkitbag.etsy.com/listing/4619159899/subcontractor-agreement-template', + p05: 'https://thedigitalkitbag.etsy.com/listing/4619178823/full-kitbag-bundle-australia-charge-out', + 'p03-uk': 'https://thedigitalkitbag.etsy.com/listing/4624460491/invoice-and-quote-templates-uk-vat-and', + 'p03-us': 'https://thedigitalkitbag.etsy.com/listing/4624461397/contractor-invoice-and-estimate', + 'p03-nz': 'https://thedigitalkitbag.etsy.com/listing/4624466664/tax-invoice-and-quote-templates-nz-gst', + 'p03-ca': 'https://thedigitalkitbag.etsy.com/listing/4624462711/contractor-invoice-templates-canada-gst', + 'starter-scripts': + 'https://thedigitalkitbag.etsy.com/listing/4624968342/payment-reminder-scripts-australia-email', } as const; export type EtsyCode = keyof typeof etsyListings; @@ -357,6 +366,13 @@ export const taggedRoutes = { 'pt-galley-associates': '/', 'pt-australian-skills-group': '/', 'pt-migas': '/', + 'pt-cdu-plumbing': '/', + 'pt-the-gordon': '/', + 'pt-vu-trades': '/', + 'pt-cit-building': '/', + 'pt-wodonga-tafe': '/', + 'pt-bcta': '/', + 'pt-tiv': '/', // Kitbag Email 'em-261127': '/go/etsy-p05/?page=em-261127&coupon=BFCM15', 'em-261127-shop': '/go/etsy-shop/?page=em-261127-shop&coupon=BFCM15', diff --git a/src/content/blog/card-merchant-fees-australia.md b/src/content/blog/card-merchant-fees-australia.md index 4d38e17..70c5c4b 100644 --- a/src/content/blog/card-merchant-fees-australia.md +++ b/src/content/blog/card-merchant-fees-australia.md @@ -93,7 +93,7 @@ The **[Getting-Paid Kit](/products/getting-paid-kit/)** (A$29 incl. GST) include If you need a place to log the fees and, once you're GST-registered, the GST credits on them, the **[BAS & GST Workbook](/products/bas-gst-workbook/)** (A$48.99 incl. GST) is an Excel workbook (it also opens in Google Sheets) with income and expense logs that work out the GST, and a BAS summary for G1, 1A and 1B. It doesn't lodge anything for you, and it isn't tax advice. -Want the charge-out, BAS and subcontractor tools as well? The Full Kitbag Bundle is all four in one download, A$179 incl. GST on Etsy. +Want the charge-out, BAS and subcontractor tools as well? The Full Kitbag Bundle is all four in one download, A$179 incl. GST on Etsy. ## Quick recap diff --git a/src/content/blog/selling-before-gst-registered.md b/src/content/blog/selling-before-gst-registered.md index 0d489f8..79a3f15 100644 --- a/src/content/blog/selling-before-gst-registered.md +++ b/src/content/blog/selling-before-gst-registered.md @@ -107,7 +107,7 @@ The **[BAS & GST Workbook](/products/bas-gst-workbook/)** (A$48.99 incl. GST) is The **[Getting-Paid Kit](/products/getting-paid-kit/)** (A$29 incl. GST) includes GST-registered and not-registered versions of the quote and invoice templates, as Word (.docx) and PDF files (the Word files open in Google Docs after upload), plus payment terms and an overdue invoice tracker. Use the not-registered versions until your registration takes effect, then switch. It isn't legal advice. -Want the charge-out, BAS and subcontractor tools as well? The Full Kitbag Bundle is all four in one download, A$179 incl. GST on Etsy. +Want the charge-out, BAS and subcontractor tools as well? The Full Kitbag Bundle is all four in one download, A$179 incl. GST on Etsy. ## Quick recap diff --git a/src/data/faq.ts b/src/data/faq.ts index a9c27c7..f4eae6d 100644 --- a/src/data/faq.ts +++ b/src/data/faq.ts @@ -1,4 +1,4 @@ -import { etsy, etsyGoHref } from '../config'; +import { etsyGoHref, etsyShopGoHref } from '../config'; export type FaqItem = { question: string; @@ -68,7 +68,7 @@ export const faqItems: FaqItem[] = [ question: 'Is there an Etsy shop?', answer: 'Yes. All five tools are listed there, including the Full Kitbag Bundle. This website is where the articles and the free calculator live. It does not take payment.', - links: [{ href: etsy.shop, label: 'Shop on Etsy' }], + links: [{ href: etsyShopGoHref('faq'), label: 'Shop on Etsy' }], }, { question: 'Where do I send a question?',