49 lines
4.0 KiB
Markdown
49 lines
4.0 KiB
Markdown
# Descrybe — consistent product SEO formulas (v6)
|
||
|
||
## What changed
|
||
|
||
- Exactly one **canonical platform default formula** is used for all category types. It is translated into the same HTML and SEO structure in all 25 supported languages. Previously, English per-category defaults came from an older source, so English could retain a five-benefit/100-word template while other languages used the new SEO layout.
|
||
- The default title order is **verified brand → localized product type → official model/ID → optional verified color**, with no artificial punctuation or invented properties.
|
||
- Descriptions follow **`<p>` → optional `<h2>`+`<p>` → optional `<h2>`+`<ul><li>…</li></ul>`**. The storefront supplies the H1. Paragraph lengths are flexible; source facts matter more than word quotas. Omit unsupported feature and specification sections instead of making up content.
|
||
- Meta title and meta description are **separate plain-text fields**, with localized instructions. Meta descriptions should be factual and readable, typically 120–155 characters when information allows, with an upper bound of 155.
|
||
- Product generation falls back to the correct localized formula when a categorized product has no stored category prompt, including on older category records.
|
||
- The API resolves HTML structure and localized meta instructions from the active category language, instead of defaulting to English meta rules.
|
||
- Frontend examples are generated from the API's bundled JSON translation rules by `node scripts/seed/build-category-ui-examples.mjs`, so the examples can't silently diverge from the backend.
|
||
- The global offline seed now rewrites **only exact known platform-default snapshots**, including mixed older versions. Old translations are versioned by prompt hash. A1-authored prompts stay custom; an exact old default in a separate A1 language can be upgraded without overwriting its original Slovenian instructions.
|
||
- New category creation, including CSV category imports, reads the one cached shared template for all languages.
|
||
|
||
## Deployment (all companies)
|
||
|
||
Use the supplied source for **API + worker + frontend**, then from its root:
|
||
|
||
```sh
|
||
npm run migrate
|
||
npm run seed:category-prompts:i18n -- -dry-run
|
||
npm run seed:category-prompts:i18n
|
||
```
|
||
|
||
Neither the offline seed nor the locale rules require `OPENAI_API_KEY`. The database seed requires `DATABASE_URL` and migration 048.
|
||
|
||
The dry run is read-only and simulates the 25 bundled translations in memory, reporting eligible categories without writing to the database. The full run updates only built-in defaults and stores their 25 translations for all current and future companies. Company-authored templates are not overwritten; exact stock old English formulas can be upgraded even when other language slots were already updated.
|
||
|
||
The A1-only cleanup remains available as a separate command for **recognized Slovenian legacy descriptions**:
|
||
|
||
```sh
|
||
npm run cleanup:a1:prompts
|
||
npm run cleanup:a1:prompts -- -apply
|
||
```
|
||
|
||
**Reprocess products** to regenerate previously generated titles/descriptions/meta based on these formulas. The seed changes category configuration, not already published/generated product content.
|
||
|
||
### Custom prompts
|
||
|
||
The seed does not replace an existing custom prompt just because it contains H2 headings or mentions technical specifications. If a supposedly default category remains unchanged, inspect its `categories.prompt`, `title_template`, and `description_template`: at least one field may differ from every known shipped default. This is intentional, to protect user changes.
|
||
|
||
## Validation
|
||
|
||
- 25/25 languages: same description block order, role markers, and explicit title/description/meta rules.
|
||
- Isolated Go 1.23 category-default and HTML/parser tests pass.
|
||
- Frontend localization/role tests pass (11 checks).
|
||
- Go backend database integration tests require the project's Go 1.25 toolchain and a reachable PostgreSQL database. The seed was **not run against the live database**; inspect the dry-run report before applying.
|
||
- Company-level rules that suppress SEO-meta output (e.g. A1 export policy) have **not** been changed.
|