Template talk:Article section

Bug: links break in talk subpages
When used on a page Talk:Foo, links to the page Foo#bar. That's good! But tif the discussion from Talk:Foo gets archived to Talk:Foo/Archive, instead links to Foo/Archive#bar if Foo/Archive exists, which is not correct. But it probably doesn't exist, so instead it's a redlink to create the article, via &action=edit&redlink=1, which is also wrong. See for example the first sentence of the first section of Wikipedia talk:Stand-alone lists/Archive 9. The template blindly uses ARTICLEPAGENAME, which is only correct if the talkpage is "at the same level" (not a subpage) as the article.

As a first pass, should we throw a visible error (rather than incorrect redlink) if the article does not exist? Shame  is "expensive". To actually solve it, we would need to figure out how many subpages to strip off until we found one that exists. I guess one solution (most common case?) would be to use  if $ifexist is false. DMacks (talk) 22:35, 5 January 2017 (UTC)