Skip to content

feat(content): suggest opportunity content types by the brand's site type - #1332

Closed
cihan-gyk wants to merge 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/opportunities-site-type
Closed

cihan-gyk wants to merge 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/opportunities-site-type

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

From the user's spec: Content Opportunities now suggest content types that fit the brand's kind of site (B2B SaaS, e-commerce, B2C), using the same page types as the Content Editor. Before, every brand got the same ten fixed asset types: a shop could get a "glossary/landing page", and a SaaS brand a "product/category page". B2B pages such as feature, use case, integration, pricing, alternatives and best-of were missing.

None of the existing calculations change. Topics, clusters, fan-out searches, est. AI volume, visibility, competitors, the brand's pages and Analytics data all stay as they are, and so do the create/optimize/expand/refresh/consolidate/defend decisions and the supporting assets. Only the type the model picks now comes from the brand's own list.

Server

  • content-page-types.js gains:
    • SITE_PAGE_TYPES and siteTypeOf, mirroring web/src/lib/content/page-types.ts: the picked brands.site_type, else the editor's guess from Shopping mode and industry. A test keeps the two copies in step.
    • sitePageTypeLines: the site's page types, each with its format, for the prompt.
  • page-matching.js:
    • ASSET_TYPES is replaced by assetTypes(siteType), which returns the site's page types plus the earned ones (third_party_article, backlink).
    • buildAssets takes that list. A primary asset of another type is a blog post, which every kind of site writes.
  • opportunity-generator.js:
    • reads site_type and shopping_mode_enabled with the brand;
    • the schema's assetType and supporting type enums use the site's list;
    • the user prompt adds the site type and its content types, one per line with its format;
    • two system-prompt lines now refer to that list.

Web

  • lib/content/asset-types.ts reads a stored type as the brand's page type.

    • Older opportunities are mapped at read time, and no rows are rewritten. The mapping is the table the user approved:

      Old type B2B E-commerce B2C
      blog_post blog_post blog_post blog_post
      pillar_guide guide buying_guide guide
      landing_page solution_page collection_page destination_page
      comparison_page comparison comparison comparison
      glossary_page definition definition definition
      faq_page docs_faq help_faq help_faq
      product_page feature_page product_page guide
      category_page solution_page category_page guide
  • Labels: useAssetTypeLabel names a type with the editor's page type labels (contentEditor.pageTypes), or with content.assetType for earned assets. The eight old content.assetType labels are gone, since the mapping covers them.

    • Opportunities list: the Type column shows the primary asset's type under the channel and decision badges.
      • It is small muted text rather than a badge: the column is 96 px, and "Third-party article" doesn't fit in a badge there.
      • It adds about 16 px to each row.
    • Opportunity drawer: a type badge next to Owned/Earned. The assets card and Copy All Data use the same names.
  • Start (New content):

    • New page: an opportunity preselects its own page type, and the dialog says "Picked from the opportunity.".
    • Existing page: the page is what its address or title shows first, because that is firmer evidence than an older opportunity's guess (/shipping stays a policy page even though an old opportunity called it a "landing page"). When neither shows anything, the opportunity's type is used.
    • Blog post, or a type the site doesn't write: the title decides, as before. "Blog post" was the old generator's default, so it doesn't override a title that says "Best …" or "X vs Y".
  • Content Plan: opportunity rows follow the same rules, so the Plan and Start agree.

Before / after on the demo brand. Acme Coffee has no site type set, and Food & Beverage makes the guess e-commerce.

Stored type Before (assets card only; the list showed Owned/Earned) Now (list, drawer, assets card, Start)
pillar_guide Pillar guide Buying guide
landing_page Landing page Collection page
product_page Product page Product page
blog_post Blog post Blog post
third_party_article Third-party article Third-party article
  • Content Plan: "Shipping & Delivery" (/shipping, stored as landing_page) still reads Policy, from its own address.
  • Start on "Create an office coffee subscription page" preselects Collection page, with "Picked from the opportunity."
  • New opportunities: for this brand, the model now picks from the 13 e-commerce types (product, category, collection, buying guide, best-of, comparison, alternatives, guide, definition, sizing guide, help & FAQ, policy, blog post) instead of the fixed ten. A side-by-side of regenerated opportunities needs one generator run on the demo brand; I'll add it here if the user approves that run.

AI cost (for @gkhngyk): each generation call gets about 150–250 more input tokens: the site type and 8–13 short content-type lines. The output is unchanged.

Related issue

None. Product spec from the user.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Content → Opportunities on a brand with older opportunities. The Type column and the drawer name each type as the brand's site reads it. On an e-commerce brand, an old "Pillar guide" shows as "Buying guide" and an old "Landing page" as "Collection page".
  2. Change the brand's site type in Brand settings. The same rows read as that site's types, for example "Feature page" for an old product page on B2B.
  3. Generate new opportunities. Their types come from the site's list (B2B: feature, use case, comparison, alternatives, pricing…).
  4. Content → Plan → Start on an opportunity row. Start preselects the opportunity's type and says "Picked from the opportunity."

Checked in light and dark, at 1024 px and wider.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md

  • Commits follow Conventional Commits

  • yarn lint passes (run from web/)

  • yarn typecheck passes (run from web/)

  • yarn format:check passes (run from web/)

  • Changes are focused — one concern per PR

  • Web: yarn test passes (283 files, 2,494 tests), and yarn build passes with CI's placeholders.

  • Server: npm run format, npm run lint and npm test pass (170 files, 2,011 tests).

  • Deploy: the server and the web can go in either order. The web reads old and new types alike, and the server only writes types the web names.

🤖 Generated with Claude Code

…type

Content Opportunities gave every brand the same ten asset types, so a
shop could get a glossary or landing page and a SaaS brand a product or
category page. The generator now reads brands.site_type (or the
editor's guess from Shopping mode and industry), lists that site's page
types with their formats in the prompt, and limits assetType and the
supporting types to them, plus the earned third_party_article and
backlink. No calculation changes.

Older opportunities keep their stored types and are read as the brand's
page types (pillar_guide -> guide / buying_guide, landing_page ->
solution_page / collection_page / destination_page, and so on). The
opportunities list, the drawer, the assets card and Copy All Data name
them with the editor's labels. Start preselects an opportunity's type
for a new page; an existing page goes by its own address or title
first. The Content Plan follows the same rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk This one comes from the user's spec: opportunities now suggest content types that fit the brand's kind of site (B2B SaaS / e-commerce / B2C), using the Content Editor's page types. No calculation changes.

AI cost: each generation call gets about 150–250 more input tokens (the site type, plus 8–13 short content-type lines), and the output is unchanged. At gpt-5-mini prices that's a small fraction of a cent per call.

Older opportunities keep their stored types. They're read as the brand's page types using the table in the PR body; no data is rewritten.

One rule you may want to check: in Start and the Plan, an existing page is typed by its own address or title first, and by the opportunity's type only when those say nothing. That way /shipping stays a policy page even where an old opportunity called it a "landing page".

Server 2,011 tests and web 2,494 tests pass, and the build passes. Deploy order doesn't matter.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It conflicts with #1320 in new-content-dialog.tsx (both change withChoice and Start's choice), and with #1321/#1329 in new-content-dialog.tsx and lib/actions/content-plan.ts. Rebase once those are in.

…es-site-type

# Conflicts:
#	web/src/components/content/new-content-dialog.tsx
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk Thanks! Merged main in (75ffe02e) now that #1320 is there. The only conflict was a doc comment in new-content-dialog.tsx's startFrom. One test now picks #1320's "Create a new page" (it was "… instead"). Server: 2,013 tests. Web: 2,508 tests and the build pass. We merge rather than rebase. #1334 already carries this branch together with #1321's latest, so whichever of #1321/#1329 lands first, I'll merge main forward again here.

@gkhngyk

gkhngyk commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Landed with #1334, which carries this branch's commits. Merging this branch into main now changes nothing, so I'm closing it. Reviewed in round 5; no open items.

@gkhngyk gkhngyk closed this Oct 22, 2026
gkhngyk pushed a commit that referenced this pull request Nov 1, 2026
A brand's site type was B2B SaaS, E-commerce or B2C. A brand whose
business is a mobile app now picks Mobile app (key `app`, as Agent
Center's business type), and everything that follows the site type
knows it.

- 00456: brands.site_type takes 'app'; so do the two tables keyed by
  the brand's site type, content_rule_sets (My rules, 00227) and
  content_quality_pages (00270), else saving rules or a page read for an
  app brand would fail its check. Constraint swaps, existing rows pass.
- Page types (web page-types.ts, server content-page-types.js): an app's
  site writes feature, comparison, alternatives, best-of, guide,
  definition, pricing, Help & FAQ and blog pages; its pricing, features
  and MobileApplication schema read as pricing and feature pages, its
  policy pages as Help & FAQ. Older opportunity types map onto these.
- Opportunities (#1332) and AI task writing take the app's page types
  and name it "Mobile app (a mobile app people install from an app
  store)"; Content Agent, brief and writer prompts too (Quality phase 2).
- Conversions from AI journeys count signups and newsletter signups.
- Quality: the regulated-advice check (health, finance, legal) applies
  to app pages as to B2C ones.
- Site type detection: a MobileApplication schema reads as an app (3),
  app store badges now count toward app instead of B2C (1, never enough
  alone), and the model's prompt describes app. A detected app that
  can't be written before 00456 is applied is skipped, as before 00379.
- Brand settings' selector and the editor's site menu offer Mobile app;
  the hint names its page types.
- Help: Start a page in New content says page types follow the site
  type; docs guides list Mobile app.

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants