Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ changes.
- `tests/metadata.test.ts` checks the title and description lengths, the canonical address, and that the share
image is a 1200 x 630 PNG on the Open Graph card and a large Twitter card.
- `tests/analytics.test.ts` checks the PostHog setup, the `?internal=1` opt-out and the Content-Security-Policy.
- `tests/structuredData.test.tsx` checks the SoftwareApplication data restates the page and states no price, offer,
rating, review or download link.

## Where things live

Expand All @@ -55,6 +57,7 @@ changes.
| Visit counts (PostHog) | `lib/analytics.ts` |
| Screenshots and alt text | `lib/screenshots.ts`, `public/images/` |
| Favicon and Apple touch icon | `app/icon.png`, `app/apple-icon.png` (from the app icon) |
| Structured data for search engines (SoftwareApplication, no price or rating) | `lib/structuredData.ts` |

### The TestFlight link

Expand Down
6 changes: 6 additions & 0 deletions website/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ import { BetaSignup } from "@/components/BetaSignup";
import { Screenshot } from "@/components/Screenshot";
import { SHOTS } from "@/lib/screenshots";
import { SITE_NAME, TESTFLIGHT_URL, betaCta, showRecorderLink } from "@/lib/site";
import { jsonLdText, softwareApplicationJsonLd } from "@/lib/structuredData";

const cta = betaCta();
const ctaTrack = { "data-track": "join_beta_clicked", "data-track-destination": cta.testflight ? "testflight" : "signup" };

export default function Home() {
return (
<>
{/* For search engines: what the app is, restating this page (lib/structuredData.ts). */}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: jsonLdText(softwareApplicationJsonLd()) }}
/>
<header className="site-header">
<div className="wrap header-inner">
<a href="/" className="brand">
Expand Down
35 changes: 35 additions & 0 deletions website/lib/structuredData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { SHOTS } from "@/lib/screenshots";
import { SITE_DESCRIPTION, SITE_NAME, SITE_URL } from "@/lib/site";

// schema.org data for search engines, in a <script type="application/ld+json"> on the page. It only restates what the
// page says. No offers, price, rating, review or download link: the app has no price and no App Store listing yet,
// so add those here only when the page states them. No FAQPage either, until the page has a real FAQ.
export function softwareApplicationJsonLd() {
return {
"@context": "https://schema.org",
"@type": "SoftwareApplication",
name: SITE_NAME,
url: SITE_URL,
description: SITE_DESCRIPTION,
applicationCategory: "MultimediaApplication",
// "iPhone, iPad and Mac" on the page; the versions are project.yml's deployment targets (iOS 26.0, macOS 26.0).
// Change them here when project.yml changes.
operatingSystem: "iOS 26, iPadOS 26, macOS 26",
image: `${SITE_URL}/images/app-icon-256.png`,
screenshot: Object.values(SHOTS).map((shot) => ({
"@type": "ImageObject",
url: `${SITE_URL}${shot.dark}`,
contentUrl: `${SITE_URL}${shot.dark}`,
width: shot.width,
height: shot.height,
caption: shot.alt,
})),
// The footer's copyright line.
author: { "@type": "Person", name: "Eric Dahl" },
};
}

// The JSON for a script tag. "<" is escaped so no text in it can close the tag.
export function jsonLdText(data: unknown): string {
return JSON.stringify(data).replace(/</g, "\\u003c");
}
62 changes: 62 additions & 0 deletions website/tests/structuredData.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { existsSync, readFileSync } from "node:fs";
import path from "node:path";
import { renderToStaticMarkup } from "react-dom/server";
import Home from "@/app/page";
import { SHOTS } from "@/lib/screenshots";
import { SITE_DESCRIPTION, SITE_URL } from "@/lib/site";
import { softwareApplicationJsonLd } from "@/lib/structuredData";

const ROOT = path.resolve(__dirname, "..");
const html = renderToStaticMarkup(<Home />);
const blocks = [...html.matchAll(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/g)].map((m) => m[1]);

describe("the page's structured data", () => {
it("is one SoftwareApplication block on the page, the same as the one in lib/structuredData.ts", () => {
expect(blocks).toHaveLength(1);
expect(JSON.parse(blocks[0])).toEqual(softwareApplicationJsonLd());
expect(softwareApplicationJsonLd()["@type"]).toBe("SoftwareApplication");
});

it("can't close its own script tag", () => {
expect(blocks[0]).not.toMatch(/</);
});

it("restates what the page says: the name, the address, the description and the three platforms", () => {
const data = softwareApplicationJsonLd();
expect(data.name).toBe("SoundcheckPlayer");
expect(data.url).toBe(SITE_URL);
expect(data.description).toBe(SITE_DESCRIPTION);
expect(data.operatingSystem).toBe("iOS 26, iPadOS 26, macOS 26");
expect(data.author).toEqual({ "@type": "Person", name: "Eric Dahl" });
});

it("gives the OS versions the app is built for, from project.yml", () => {
const project = readFileSync(path.join(ROOT, "..", "project.yml"), "utf8");
const target = (os: string) => project.match(new RegExp(`^\\s+${os}: "(\\d+)\\.\\d+"`, "m"))?.[1];
expect(softwareApplicationJsonLd().operatingSystem).toBe(
`iOS ${target("iOS")}, iPadOS ${target("iOS")}, macOS ${target("macOS")}`,
);
});

it("states no price, offer, rating, review or download link: the app has none yet", () => {
const json = JSON.stringify(softwareApplicationJsonLd());
expect(json).not.toMatch(/"(offers|price|priceCurrency|aggregateRating|review|ratingValue|installUrl|downloadUrl)"/);
expect(json).not.toMatch(/apps\.apple\.com|testflight/i);
});

it("never calls the app Virtual Soundcheck, and never names the Cambridge-MT test Stems", () => {
const json = JSON.stringify(softwareApplicationJsonLd());
expect(json).not.toMatch(/Virtual Soundcheck/);
expect(json).not.toMatch(/Scarlett|Maracas|Cabasa|Elec ?Piano|Percussion/);
});

it("lists the page's own screenshots, with their alt text as captions", () => {
const shots = softwareApplicationJsonLd().screenshot;
expect(shots).toHaveLength(Object.keys(SHOTS).length);
for (const shot of shots) {
expect(shot.url).toMatch(/^https:\/\/soundcheckplayer\.app\/images\/(player|takes|preview)-dark\.jpg$/);
expect(existsSync(path.join(ROOT, "public", shot.url.replace(SITE_URL, "")))).toBe(true);
expect(Object.values(SHOTS).map((s) => s.alt)).toContain(shot.caption);
}
});
});
Loading