Using the DT permalinks metadata database, we should be able to look up the pain section link in the full history of the page (which is contained within DT IDs).
Once we have a DT ID, we can do our normal search to find where the topic currently resides on the wiki. No need to configure what an archive page path looks like on a per-wiki basis.
===Gadgets===
There are two gadgets that implement this behaviour already, with nearly identical mechanisms (possibly one copied the other?):
* find-archived-section on en.wiki
* ConvenientDiscussions on ru.wiki and others
Both gadgets use the search API with srprop=sectiontitle and a pre-defined per-wiki prefix, e.g. "Page name/Archive...". CD switched to using mw.notify notifications instead of a banner to display the results.
When multiple results are found, the most recent one is displayed. In all cases (0/1/many results) a search link is provided, although this requires knowing about the archive prefix, so we would omit this from our implementation.
|CD | find-archived-section
|{F40328082}|{F40328118}