- pageNamespaceId = titleObj.getNamespaceId(),
- isTalk = pageNamespaceId % 2 === 1,
- associatedTitle = mw.Title.makeTitle( isTalk ? pageNamespaceId - 1 : pageNamespaceId + 1,
- titleObj.getMainText() ).getPrefixedText();
+ associatedTitleObj = titleObj.isTalkPage() ? titleObj.getSubjectPage() : titleObj.getTalkPage(),
+ associatedTitle = associatedTitleObj.getPrefixedText();