Prompt: SEO listing pages
SEO listing pages at /homes/<slug> with every screen of the listing page, head tags, JSON-LD, loading and not-found states, sitemaps, and real 301, 404 and 410 status codes.
This prompt builds the listing detail page with everything around it: every screen of the page (the gallery, the share, contact and tour screens, the mortgage calculator and the location map), the loading and not-found states, the middleware for the status codes, the page for a removed listing, the sitemaps and robots.txt.
The prompt
Read RUUSTER_IDX.md first and follow its MUST and NEVER rules. Ask me if it doesn't cover something.
Build SEO listing pages at /homes/[slug] that follow the recipe at <https://help.ruuster.com/idx/recipe-listing-detail>. Read the listing id with parseListingSlug, call GET /v1/listings/{listingId} on the server with my secret key, and render the ListingDetail component with every screen turned on: backHref set to my search page, agent set to my own agent or office [name, photo URL, phone, email, brokerage and license number], leadAction set to my own lead route with my consent wording in consentText, shareUrl set to the page's own URL on my domain, googleMapsKey and mapId from my own Google Maps key, and apiBaseUrl="/api/idx" for the mortgage calculator (my own listings route, made with createListingsRoute from @ruuster/idx/route). Set the metadata from the listing's head object, print its JSON-LD with the JsonLd component, and add loading.tsx with ListingDetailSkeleton and not-found.tsx with ListingUnavailable and a link back to my search page. Add middleware so an outdated slug answers a 301 to the listing's current path and a removed listing answers HTTP 410 with noindex and a page of similar homes. An unknown id answers 404. Add app/homes/sitemap.ts built from GET /v1/listings/ids (split at 50,000 URLs), app/sitemap.ts for my own pages, and app/robots.ts that lists both.
Use these environment variables: IDX_SECRET_KEY (server only), NEXT_PUBLIC_GOOGLE_MAPS_KEY, NEXT_PUBLIC_GOOGLE_MAP_ID, SITE_ORIGIN and SITE_NAME. Never paste a secret key into a chat, and never put IDX_SECRET_KEY in browser code, a URL or a log. No key goes in any page: my pages call my own /api/idx route, made with createListingsRoute from @ruuster/idx/route, which adds my secret key on the server (on a site with no server, the widgets call the API with no key from my approved website address). The contact and tour screens post to my own server route, which sends the lead to my CRM; never call a CRM from the browser.
Fair housing: describe homes, places and amenities only. Never describe the people who live in an area or who a home or area suits, and never rank schools as a reason to buy.
When you are done, tell me how to check each status code with curl -sI, how to test a page in Google's Rich Results Test, and how to open the gallery, the share screen, the contact screen and the tour screen on a live listing and send a test tour request to my CRM.What it builds
app/homes/[slug]/page.tsxwithListingDetailand every screen prop (backHref,agent,leadAction,consentText,shareUrl,googleMapsKey,mapId, andapiBaseUrl="/api/idx"for the mortgage calculator), and theJsonLdcomponent, with no key in the pageapp/homes/[slug]/loading.tsxwithListingDetailSkeletonandapp/homes/[slug]/not-found.tsxwithListingUnavailablemiddleware.tsfor the 301 and the 410, andcomponents/gone.tsxwith similar homesapp/homes/sitemap.ts,app/sitemap.tsandapp/robots.ts
How to check it
curl -sIa live listing (200), an old slug (301 with alocation), a removed listing (410) and an unknown id (404).- View source on a live listing and find the address, the price, the attribution and the JSON-LD block.
- Click a photo, the share button, "Contact" with your agent's name and "Choose tour time". Each screen opens, and Escape closes it.
- Send a test tour request and find it in your CRM with the date and time you picked.
- Paste a listing URL into Google's Rich Results Test, and fetch
/homes/sitemap/0.xml.
Before you paste it
Follow the setup on Build it with your AI coding assistant once: RUUSTER_IDX.md at the root of your project, the two lines in CLAUDE.md or AGENTS.md, and your keys in .env.local. Never paste a secret key into a chat. Replace the text in square brackets with your own before you send the prompt.