Skip to content

INDEX function has no reference page — slug collides with the section index #56

Description

@hhimanshu

Problem

functions.json holds 516 function entries, but only 515 reference pages exist. The
missing one is INDEX.

scripts/gen-docs.mjs slugifies function names to [a-z0-9]+ with dashes, so INDEX
index. That collides with the generated section index at
content/docs/reference/functions/index.mdx, which wins — the INDEX function page is never
written.

Impact (verified 2026-08-05)

  • https://docs.truecalc.app/reference/functions/index404
  • content/docs/industries/operations.mdx:126 links to /reference/functions/index — a broken
    internal link on a published page
  • INDEX is half of the INDEX/MATCH idiom, and comparisons/vlookup-vs-xlookup-vs-index-match.mdx
    exists — so the gap lands on one of the more prominent lookup topics
  • The section index page itself renders "516 functions", which overstates what is actually
    documented

Reproduce

node -e "
const fs=require('fs');
const j=JSON.parse(fs.readFileSync('<core>/functions.json','utf8'));
const files=new Set(fs.readdirSync('content/docs/reference/functions')
  .filter(f=>f.endsWith('.mdx')&&f!=='index.mdx').map(f=>f.replace(/\.mdx$/,'')));
const slug=n=>n.toLowerCase().replace(/[^a-z0-9]+/g,'-');
console.log(j.map(f=>f.name).filter(n=>!files.has(slug(n))));
"
# => [ 'INDEX' ]

curl -s -o /dev/null -w '%{http_code}\n' https://docs.truecalc.app/reference/functions/index
# => 404

Suggested fix

Reserve route-colliding slugs in gen-docs.mjs. index is the only collision today, but the
rule should be general — any function name that slugifies to a reserved route needs a suffix
(e.g. index-function) with the section index linking to it under the plain INDEX label.

Worth adding a generation-time assertion that every functions.json entry produced a page, so a
future collision fails the build instead of silently dropping a function.

Acceptance criteria

  • A reference page exists for INDEX and is reachable
  • /reference/functions links to it under the label INDEX
  • industries/operations.mdx:126 resolves (no 404)
  • gen-docs fails the build if any functions.json entry yields no page
  • The section index count matches the number of pages actually generated

Context

Found while adding a derive-don't-quote rule for function counts — the workspace had been
repeating a stale "484 functions" figure. Deriving the real number from functions.json is what
exposed the missing page.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions