Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirects to other pages are sometimes included in the Lua table #1

Closed
mrstradivarius opened this issue Feb 20, 2024 · 1 comment
Closed

Comments

@mrstradivarius
Copy link
Owner

mrstradivarius commented Feb 20, 2024

When fetching redirects to a template, sometimes redirects to different pages are being included. This results in those redirects being included in the Lua table.

See, for example, line 75 of Module:Pagetype/softredirect/sandbox. This template, Template:Taxonomy/Olindiasidae, is a redirect, but it does not redirect to Template:Soft redirect with Wikidata item; it only links to it.

@mrstradivarius
Copy link
Owner Author

This is caused by dablinks.py using BasePage.backlinks on line 45. This method lists all links, not just redirects. While dablinks.py uses the filter_redirects option to this method to return only redirects, this does not ensure that the redirect target is the desired page; pages that are redirects to other targets are also included if they link to or transclude the desired page in the redirect body. The correct method to use is the BasePage.redirects method; this method will only return redirects where the target is the desired page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant