User:Certes/Reports/Links to absent portals
This query lists template uses such as {{tlx|Portal|History|Foo|Science}} or {{tlx|Portal-inline|Foo}} where Foo is not a portal nor a redirect to one. If multiple portals are listed for one article, they usually appear in the same template call. There will be some false positives, where an article has no such template but links to a portal in another way. However, no actual portals are listed. Most should be removed but some can usefully be replaced by similar portals which do exist. For example, {{tlx|Portal|Judaïsme}} obviously attempts to link the actual Portal:Judaism.
From quarry:query/60682
{{Database report
|sql=
SELECT page_namespace AS ns, page_title AS article, lt_title AS portal
FROM linktarget
JOIN pagelinks ON pl_target_id=lt_id
JOIN page ON page_id=pl_from AND page_namespace IN (0, 100) AND page_title NOT LIKE "%cuisine%" AND page_title NOT LIKE "%Cuisine%"
WHERE lt_namespace=100 AND lt_title NOT LIKE "%/%" AND lt_title NOT LIKE "%_(state)" /* Top level portal */
AND NOT EXISTS (SELECT 1 FROM page WHERE page_title=lt_title AND page_namespace=100) /* Portal is a redlink */
AND EXISTS (SELECT 1 FROM templatelinks WHERE tl_from=pl_from AND tl_target_id IN
(SELECT lt_id FROM linktarget WHERE lt_title LIKE "Portal%")) /* Article uses Portal... templates */
ORDER BY article, portal
|wikilinks= 2:c1,3:100
|excerpts=
|comments=
|interval=
|table_style=
|pagination=
|max_pages=
}}
----
{{Database report/footer|count=459|query_runtime=3.61|last_updated=18:17, 23 October 2024 (UTC)}}
{{Database report end}}