Jump to content

Template talk:Link if exists

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

The history of the previous version of this template can be found at Template:Link if exists/oldTemplate:Link if exists/old.

Requested move

[edit]
The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review. No further edits should be made to this section.

The result of the move request was: move the page, per the discussion below. Dekimasuよ! 01:40, 27 October 2014 (UTC)[reply]


Template:LinkifTemplate:Link if exists – Most transclusions point to the new name. Petr Matas 01:45, 21 October 2014 (UTC)[reply]


The above discussion is preserved as an archive of a requested move. Please do not modify it. Subsequent comments should be made in a new section on this talk page or in a move review. No further edits should be made to this section.

How is this different?

[edit]

Can someone explain how this functions differently than {{Auto link}}? Is there a reason the 2 cannot be merged? --Zackmann (Talk to me/What I been doing) 04:09, 4 November 2025 (UTC)[reply]

They are slighly different:
I set this behavior in {{Link if exists}} to avoid a bug in another template. If you do merge them, you should preserve this behavior. — hike395 (talk) 10:08, 4 November 2025 (UTC)[reply]
@Hike395: thanks for the explanation. I tried to parse the code but got a little lost. What are your thoughts on merging the two? It would seem, from your explanation, that {{auto link}} could just be redirected to {{link if exists}}? Zackmann (Talk to me/What I been doing) 16:57, 4 November 2025 (UTC)[reply]
They have different arguments, so one cannot be redirected to the other. Let me whomp up a Lua module to implement both. I'm trying to take a wikibreak, but will try to slip this in. — hike395 (talk) 00:14, 5 November 2025 (UTC)[reply]
 Implemented --- I made Module:Link if exists that implements a superset of both templates. See Template:Link if exists/testcases and Template:Auto link/testcases. Note that there is a slight difference with the existing template implementation, because the module returns the full text of the article link (e.g. A) rather than using whatever is given to the template (e.g. a). In practice, this should not make a difference -- it will link to the correct article.
Right now, the module implements the superset. We can either
  • Make two new entry points in the module and leave the templates as distinct, or
  • Unify the two templates and write documentation that describes the union of the parameters.
hike395 (talk) 01:34, 5 November 2025 (UTC)[reply]
Thanks! Good luck on that wikibreak... Zackmann (Talk to me/What I been doing) 03:10, 5 November 2025 (UTC)[reply]
For now, I made two entry points and have both template share a Lua implementation. If we wish to merge the templates, then one would redirect to the other, and the one that is kept would call {{#invoke:Link if empty|main}} to implement the merged behavior. — hike395 (talk) 05:01, 5 November 2025 (UTC)[reply]