Fix: Create TemplateStyles stylesheets in Template namespace on test wikis

Initialising the "Content categories" template on a test wiki failed with "You do not have permission to edit this CSS page". T429067 moved the category navbar from inline table styling to a TemplateStyles subpage, and on test wikis templatePrefixFor() puts every page under a "User:/Starter kit/" prefix — so the stylesheet became a User-namespace .css page. Those are protected user-CSS config pages an OAuth session cannot create; the create was rejected and aborted the whole init. (Production was unaffected: with no prefix the sheet already lives in Template:, an ordinary sanitized-css page anyone can create.)

Keep TemplateStyles .css pages in the Template: namespace even on test wikis; only the template pages take the User: prefix. A User: page can reference a Template: stylesheet cross-namespace, which MediaWiki allows.

  • template-registry.js getRequiredTemplates(): stop rewriting cssSubpages target titles with the custom prefix — they stay under Template:. Fixes content- categories and the same latent break for sister-projects / wikipedia-languages.
  • wikitext-generator.js _navbarStylesSrc(): always resolve the navbar stylesheet to Template: (drop the templatePrefix arg), so the generated matches the page that init now creates. Removed the then-unused templatePrefix param from generateNavbarTemplateContent() and its two callers.

Not changed: /templates/init stays create-only, so an already-created template still carrying the old User: src must be deleted (or re-inited under a new title) to pick up the corrected src. Preview is unaffected — it inlines the collected CSS regardless of the src.

Co-Authored-By: Claude Opus 4.8 Bug: T429067

Merge request reports

Loading