Template talk:Pin message

Flaws in "next" param
The template has a design flaw and a bug in connection with param next when used on a page that has auto-archiving (or in some cases, that is manually archived). The design flaw, is that the next param calls for a value naming the following section, but this is doomed to fail, eventually. By its nature, a pinned message will eventually land at the top of a talk page as older messages are archived. The "next" param will then point to the following discussion on the page. However, eventually that section will be archived as well (unless pinned), and the "next" param will cease to function.

As a workaround, instead of naming the title of the next discussion in the parameter, use an expression like bottom of this section and then add an anchor at the bottom of the section with the same value. It might be worth creating a new template, Pin message bottom, to generate an anchor, as editors are accustomed to "top-bottom" template pairs that are used in this way. (It could even be used to skip multiple, adjacent pinned messages.)

For an example of a problematic use of Pin message, see Talk:Same-sex marriage: This workaround will continue to work, no matter what section appears following the pinned message.
 * working, rev. 964771910 on 27 June 2020, when "next" param was added, pointing to next section #Increase article stability
 * broken, rev. 987275555 on 6 November 2020, when Lowercase sigmabot III archived that section
 * working, rev. 1014217517 on 25 March 2021, using the "anchor" workaround.

The bug, is that the "next section" link, which should be a simple, on-page link, instead is coded erroneously with in the link, forcing the section link to go to the current version of the page, meaning that section links do not work in older versions, even when they are correct for that version.

For an example of this failure, see the link in the first bullet above ('working, rev 964771910'). This link targets an old version from 27 June 2020, and had the section link been correctly coded (even using the name of the following section) then clicking it would still work now, using an on-page link. Instead, due to the bug, the "next" link goes instead to the current version of the page, even though it worked at the time.

If done a bit cleverly, generation of the next param could be automated, or defaulted, so that Pin message would generate an automatic value for "next" (e.g., integer timestamp), and then Pin message bottom would pick up the same value for the anchor, and the user wouldn't have to code a value at all, it would just work, even with multiple pinned message on the page. Thanks, Mathglot (talk) 21:36, 25 March 2021 (UTC)