Skip to content

Placing keywords you can actually count

A placement rule that fits on one line, and why counting them in your source file gives the wrong answer.

7 min read

Level 0

Curious

0 XP
150 XP to ApprenticeNo streak yet0 badges0% done

Keyword rules go wrong in two directions. Too vague and Claude stuffs. Too rigid and the prose reads like it was built out of a spreadsheet.

The version that works is a placement rule, not a density target:

PRIMARY keyword:
  - meta title
  - meta description
  - H1
  - exactly ONE H2
  - exactly TWICE in body prose

Each SECONDARY keyword:
  - once in body text

Anything beyond that: soften it to a variant.
Specific enough to check, loose enough to write around. Notice it says exactly, not at least.

Cap it, do not floor it

"At least twice" turns into eleven. "Exactly twice" turns into two, and forces the rest of the article to use natural variants, which is what you wanted anyway.

Count the output, not the source

This is where people get a number that is confidently wrong in both directions.

Count in your source file and you undercount, because a multi-word phrase wraps across two lines and a line-by-line search never sees it. Count in the finished web page and you can overcount by a huge factor, because modern sites embed a second copy of the whole page inside the HTML for the browser to use.

claude
>How many times does the primary keyword appear in the body?
Bash(grep -c 'inventory forecasting' page.html)
17
Seventeen. Panic. Except the real answer is two, and the other fifteen are in a duplicate copy of the page baked into the HTML.
That count includes embedded script data. Stripping scripts, the head, and the H1, then collapsing whitespace before counting.
Bash(strip scripts + head + h1, collapse whitespace, count)
2
Two. Correct. Collapsing whitespace is what catches phrases that wrapped across lines.

The three-step counting recipe

  1. 1.Strip the machinery. Remove scripts and embedded data before counting anything.
  2. 2.Separate the slots. Count the H1, the meta title and the meta description on their own. They are supposed to contain the keyword, so leaving them in the body count is what makes a correct article look like it is stuffed.
  3. 3.Collapse whitespace. Turn every run of spaces and line breaks into one space before searching. Otherwise a phrase that wrapped is invisible.
Challenge

Six or two?

35 XP+9 perfect

A check reports the primary keyword six times in body prose. The rule says exactly two. Before you start deleting, what do you do?

Pick the first move.

Finished reading?

Mark it done to bank the XP and keep your streak alive. Any challenges on this page score separately, so you can come back for a perfect run later.