Scribunto mw.title getContent() method can record templatelinks to special pages.
To reproduce, create Module:Test as follows:
local p = {} function p.main(frame) local t = mw.title.new('Special:BlankPage') return t:getContent() end return p
Then use it in another page:
{{#invoke:Test|main}}
I think this is a bad behavior for several reasons.
- getContent() probably shouldn't even work on special pages, as they have no wikitext content. While special page transclusion is a thing, getContent() on a transcludable special page doesn't do that anyway.
- Special page transclusion does not record templatelinks. (Links to special pages don't record pagelinks, either – and neither does mw.title.exists().)
- Special:WhatLinksHere doesn't let you view those links. If it did (just comment out 'creatable' => true,), the recorded links don't normalize the page title – e.g. Special:BlankPage and Special:blankpage are distinct.
- Other code may not expect it either (for example, see T376964, which is how I found this problem originally).
By the way, there's a comment in ParserOutput that warns about the problem with normalization:
// We don't want to record Special: links in the database, so put them in a separate place. // It might actually be wise to, but we'd need to do some normalization. $this->mLinksSpecial[$dbk] = 1;