Skip to content

fix(content): start the agent's headings and title with a capital, in the page's language - #1626

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:fix/agent-heading-case
Oct 28, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:fix/agent-heading-case

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

The test page had a heading written in lower case: "latest news ChatGPT".

  • content-writer.js gets headingCase. It capitalizes the first letter in the page's language (Turkish i → İ), leaving names like "iPhone" and "eBay" as they are.
  • renderPage takes { language } and applies it to the H1 and the headings.
  • The draft's title column is saved with the same capital as the H1, so the Library, the CMS name, the slug and the meta title match it.

Needs the API deploy.

Related issue

None. From Ansvisor’s production test of the Content Editor and Send to CMS (2026-10-27).

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

cd server && npx vitest run src/lib/content-writer.test.js

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

Checked together with the other PRs from the same test (one integration tree of all eleven on main 3f6a4d4):

  • server/: npm run format, npm run lint and npm test (3,349 tests).
  • web/: yarn format, yarn lint (0 errors, the 7 earlier warnings), yarn typecheck, yarn test (4,385 tests) and yarn build.
  • This branch's own tests were also run on it alone.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 28, 2026 01:02
…he page's language

A page the Content Agent wrote had an H2 "latest news ChatGPT": a fan-out
used in its own words, as the fan-out rules ask, and fan-outs come
lowercase.

- A new page's headings (its title, H2s, FAQ heading and questions) start
  with a capital when their first word is all lowercase, in the page's
  language (Turkish "i" becomes "İ"); a name written lowercase on purpose
  ("iPhone", "eBay") stays as it is (headingCase, renderPage's language).

Split out of fix/agent-fanout-headings (230f7f54); reading a joined
fan-out as each search is its own branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The H1 went through headingCase but the title column kept the model's
words as written (clean(written.title)), so a lowercase title read
"latest news…" in the Library and the header while the page's H1 read
"Latest news…". The title is now saved through headingCase in the page's
language too, as the H1 shows it. A test writes an English and a Turkish
("istanbul" → "İstanbul") title and reads both the column and the H1.

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

@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, with follow-ups.

I checked headingCase in Turkish: istanbul → İstanbul, ılık süt → Ilık süt, İstanbul/IŞIK/ChatGPT nedir left as they are. az and tr-TR behave like tr. iPhone, eBay, 2026 rehberi and e-posta come out right. draftLanguage returns a code (languageCodeOf), so the locale is always one the runtime reads. It runs linearly on long input. The title column and the H1 match, and the new tests fail without the change.

Follow-ups:

  1. (medium) Only a new page's write path is covered. On an existing page, the agent's suggestions insert H2s with a fan-out's own words (FANOUT_RULE), which is where lowercase headings come from most. A whole-page rewrite's headings aren't covered either. Applying headingCase to the h1–h3 an insert or a rewrite brings in would cover both.
  2. (low) With no language, toLocaleUpperCase(undefined) (content-writer.js:235) uses the server's default locale. Plain toUpperCase() there doesn't depend on the host.
  3. (low) Edge cases, if they matter:
    • It capitalizes the first character, not the first letter, so ¿qué es AEO? and "nasıl" yapılır stay lowercase.
    • Dutch ijsland becomes Ijsland, where Dutch writes IJsland.
    • A brand written all lowercase (npm) becomes Npm. Leaving the first word alone when it is the brand's name as written would avoid that.

Before the API deploy: no change. It's a server change.

@gkhngyk
gkhngyk merged commit bbf13ba into ansvisor:main Oct 28, 2026
6 checks passed
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