**User story:**
As a Wikdiata editor,
I want the ability to use redirects and the target article as independent sitelinks
in order to match Wikidata and Wikipedia appropriately in complicated cases.
**Problem:**
* In T235420 we added badges to indicate sitelinks to redirects but they can't be used because the edits related to them can not be made (as redirects are followed and sitelink conflict occur)
* https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/602422 contains some work in this direction but is probably not the right approach, (per Adam's comment at T235420#6791998) Adam notes: "Looking at the patch lots of the code will end up being reused, but it will need the addition of some checks etc to optionally pass MediaWikiPageNameNormalizer::NOFOLLOW_REDIRECT into the service etc."
**Solution**
We want to allow sitelinks to redirects but only under certain conditions. In detail this means:
* The default behavior always tries to normalize sitelinks (following redirects) and thus these sitelinks are rejected in cases where the target of the redirect is already a sitelink
* A sitelink to a redirected pages can be added to an Item if and only if a redirect badge [[ https://www.wikidata.org/wiki/Special:AvailableBadges | (sitelink to redirect (Q70893996), intentional sitelink to redirect (Q70894304)) ]] is added in the same edit
* Adding a redirect badge to an existing redirect sitelink is possible
* Removing a redirect badge from a sitelink that points to a redirected page is disallowed
**BDD**
GIVEN an Item
AND a page on the client that is a redirect
AND the redirect target is already used in another Item
WHEN adding the page as a sitelink to the Item
AND not adding a redirect badge in the same edit
THEN the edit is rejected
GIVEN an Item
AND a page on the client that is a redirect
WHEN adding the page as a sitelink to the Item
AND adding a redirect badge in the same edit
THEN the sitelink and associated badge are stored (even if the redirect target is already used in another Item)
GIVEN an Item
AND a page on the client that is a redirect
WHEN adding a redirect badge to the sitelink
THEN the badge is stored with the sitelink
GIVEN an Item
AND a page on the client that is a redirect
AND the redirect target also has a sitelink in another Wikidata Item
WHEN trying to remove the redirect badge from the sitelink
THEN the edit is rejected
**Acceptance criteria:**
[] Default behavior remains unchanged - no need to change any error messages or similar
[] Sitelinks to redirect pages are accepted if and only if there is a redirect badge attached to them
**Notes:**
Patches from previous tickets are https://gerrit.wikimedia.org/r/c/mediawiki/core/+/602412 and https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/602422
Which includes code for turning on / off specific parts of title / sitelink normalization.
**Open questions:**
**Community communication:**
Who we needs to keep in the loop and in what way:
Who this could be interesting for and in what way: