# Implementer — F-015 SEO core: structured data, sitemap, redirects ## Summary Implemented SEO core for the storefront catalog and added the missing public brand listing needed by sitemap generation. ## Backend changes - Added `BrandRepository.list()` and `ListBrands` use case. - Added public `GET /brands` route returning `{ items: [...] }` in stable `name ASC, id ASC` order. - The endpoint is read-only and public, matching existing public `/marca/:slug` behavior. ## Storefront SEO changes - Added `project/storefront/src/lib/seo/json-ld.tsx`: - Organization JSON-LD. - Product JSON-LD. - BreadcrumbList JSON-LD. - Safe JSON-LD script rendering with `<` escaped. - Added Organization JSON-LD and root canonical/OpenGraph metadata in `layout.tsx`. - Added Product + Breadcrumb JSON-LD to `/productos/[slug]`. - Added Breadcrumb JSON-LD to `/categoria/[slug]` and `/marca/[slug]`. - Added `sitemap.xml` metadata route: - Static public routes: `/`, `/products/search`. - Active products through `searchProducts()` pagination; backend search enforces `activeOnly = true`, excluding draft content. - Category URLs from flattened `listCategoryTree()`. - Brand URLs from new `listBrands()`. - API failures degrade to static URLs instead of failing the build. - Added `robots.txt` metadata route allowing public crawl, disallowing `/api/`, and pointing to sitemap. - Added redirect store and proxy: - `project/storefront/src/lib/seo/redirects.ts` defines `RedirectRepository` and env-backed parser. - `project/storefront/src/proxy.ts` returns HTTP 301 for configured same-origin local path redirects. - `REDIRECTS_JSON` accepts an array like `[{ "from": "/old", "to": "/new" }]`. - Parser rejects external URLs, protocol-relative URLs and self-redirects. ## Documentation - Updated `project/README.md` with: - Public `GET /brands` route. - JSON-LD coverage. - `sitemap.xml` / `robots.txt` behavior. - `REDIRECTS_JSON` redirect format. ## Evidence - `cd project/storefront && npm run lint` — PASS. - `cd project/storefront && npm run typecheck` — PASS. - `cd project/storefront && npm run build` — PASS. Build output includes `/robots.txt`, `/sitemap.xml`, and Proxy. - `cd project && npm run lint` — PASS. - `cd project && npm run typecheck` — PASS. - `cd project && npm test` — PASS: 17 passed, 7 skipped; 64 assertions passed, 33 skipped. - `./scripts/verify.sh` — PASS. ## Notes - No new dependency was added. - No hreflang or external SEO tooling integration was added, per scope. - Google/Lighthouse online validators were not available in this environment; validation is structural plus Next build/typecheck evidence.