Topic on Manual talk:Pywikibot

Add Sitelinks to Wikipedia with badge 'intentional sitelink to redirect'

2
Tidoni (talkcontribs)

Hi, i am trying to add a Sitelink to a Wikidata Entry, pointing to a site in a wikipedia project that is a redirect. When i add the page directly, the redirect gets resolved an the sitelink gets added as the page behind the redirect. I assume i have to somehow set the badge 'intentional sitelink to redirect'. I tried searching for a guide or documentation on that, but could not find it. Can someone point me to a page where this is described, or does someone know, if this even is a feature that is supported? Thanks in Advance

Matěj Suchánek (talkcontribs)

It should be possible using SiteLink:

from pywikibot import ItemPage, SiteLink
site = ...
repo = pywikibot.Site('wikidata')
item = ItemPage(repo, 'Q4115189')
link = SiteLink(title, site, [ItemPage(repo, 'Q70894304')])
item.setSitelink(link)

or that like.

Reply to "Add Sitelinks to Wikipedia with badge 'intentional sitelink to redirect'"