Template talk:Archive list

Active discussions

ifexist limitEdit


This template generates 101 calls fo #ifexist. Per Wikipedia:Village_pump_(technical)#.23ifexist_limit, the devs will be blocking all pages from making more than 100 calls to #ifexist for performance reasons, which would put all pages transcluding this immediately above the limit.

I would suggest restructuring this as 10 blocks based on 10 calls to #ifexist, rather than having an #ifexist call for each possible archive. Dragons flight 21:41, 1 December 2007 (UTC)

The template currently works the following way:
  • Link to archive 1.
  • Does archive 2 exist? If so, link to it. Otherwise, give up.
  • Does archive 3 exist? If so, link to it. Otherwise, give up.
  • Does archive 4 exist? If so, link to it. Otherwise, give up.
  • etc
This means that once the new algorithm for following #ifexist is used (where each branch is only followed when necessary), the pages transcluding this template should only make as many #ifexist calls as there are archive pages. In most cases, this number should be well below 101.
It would be possible to restructure the template to test if a block of pages exists, and narrow down from there until the exact number of archive pages is found. Depending on how it's implemented, this would generate approximately 8 #ifexist calls per page but it would be fairly complex to code and it would need to be tested in a sandbox before being put in the live version. Tra (Talk) 01:15, 2 December 2007 (UTC)
I've created a version at Template:Archive list/sandbox that should cut down on #ifexist calls once the new mechanism for parsing #if works (i.e. only look at the branches that need to be looked at, instead of all of them), but doesn't require this change to be made to the #ifexist mechanism. Tra (Talk) 21:55, 4 December 2007 (UTC)

{{editprotected}} I've updated Template:Archive list/sandbox with a version that doesn't use #ifexist at all. -- Fullstop (talk) 05:53, 8 January 2008 (UTC)

Disabled due to display:none issues. More info available here: Wikipedia:HiddenStructure. Cheers. --MZMcBride (talk) 06:19, 8 January 2008 (UTC)

Links per lineEdit

{{editprotected}} Can the links per line be defined as I have done in the sandbox? Right now it is only #s that are multiples of 5, to keep the size down. MrKIA11 (talk) 17:06, 11 January 2008 (UTC)

I just want to point out the parameter name nobr isn't good, there's an HTML tag called nobr which does nowrap for text. —Dispenser (talk) 19:17, 11 January 2008 (UTC)
I changed nobr to break, but I think that even that is not the best name, I just can't think of anything short and sweet. Maybe links or line? MrKIA11 (talk) 20:11, 11 January 2008 (UTC)
I'd like to see something a bit more flexible where I could specify a multiple to the line breaks to appear. —Dispenser (talk) 20:40, 11 January 2008 (UTC)
The sandbox version is based on another version that was rejected previously due to accessibility issues. Would it be possible to have the proposed method be based on the existing version at Template:Archive list? Tra (Talk) 20:51, 11 January 2008 (UTC)
I changed it to be based on the current version. I also changed it so it can take any multiple (up to 100 of course). As you can see though, it increases quite a bit in size. All of my changes I assume will work. I'm not very experienced with HTML, but from what I have read, what I did makes sense in my head. MrKIA11 (talk) 21:05, 11 January 2008 (UTC)
I've tested it a bit in a show-preview window and I think the main problem is that currently, there is by default a line break every 10 links and the line breaks can be disabled by setting nobr=yes. In the new version, the default is to have no line breaks unless otherwise specified. This may mess up existing uses of the template. Tra (Talk) 22:21, 11 January 2008 (UTC)
I'm not very sure about this stuff, but would putting {{{links|10}}} at the beginning set the default for the links parameter to 10? MrKIA11 (talk) 22:30, 11 January 2008 (UTC)
Not done. There really isn't a compelling reason for #ifexist to not be used at the moment. rel2abs can cause serious issues when mixed with a CSS hack, as mentioned above. Also, nobr, while it is an HTML tag, is a perfectly fine parameter name, especially when it removes the presence of br tags. Unless there is a reason to update this template, it's my view that it should either be deprecated in favor of a bot doing the archive boxes or be left alone. --MZMcBride (talk) 22:55, 11 January 2008 (UTC)
I thought about using {{{links|10}}} in place of just {{{links}}} but just having that on its own would cause the pages using nobr=yes to stop working, so extra code would be needed to handle the nobr=yes parameter. What I've done in the sandbox is to use the new code except for at the end of each group of 10 links, where it would check if links= has been specified, and if it hasn't been specified, it would insert a line break or comma depending on the presence of nobr=yes.
When testing this, the existing uses of {{archive list}} appear identical under the sandbox template (i.e. the template is fully backwards compatible), and when testing links=, this appears correctly too.
One other issue is that the size of the template is almost doubled. This means that under the old version, I could repeat the template 72 times on a page before it broke, but under the new version, the template can only be repeated 42 times. However, this testing was carried out by repeating links to an identical set of archives - in practical use, the template could only be used 5 times since it uses 100 #ifexist calls for each set of archive pages, and the limit is 500 #ifexist calls. Therefore, the increased size of the template should have negligible effect.
In response to MZMcBride, the css hack is no longer in use, and nobr is working correctly again. I think this change would be a good idea and should be implemented as it would allow greater flexibility in listing archives. Tra (Talk) 23:24, 11 January 2008 (UTC)
First of all, I think it would help if the admin actually read the code. The current template uses rel2abs and the sandbox version still uses #ifexist. The sandbox is the same as the current version, but with more options. Tra, when you say it can be used 5 times, do you mean on the same page? If so, why would it be on any given page more than once? Can the {{editprotected}} be placed again, so someone else can review it, or is that not allowed since it was already reviewed? MrKIA11 (talk) 23:42, 11 January 2008 (UTC)
Yes, that's 5 times per page, assuming that no other #ifexist calls are used on that page (or templates transcluded on to that page). If there are other #ifexist calls, the limit would come down. As an example of where it's used more than once, there's Wikipedia:Village pump archive which links to the archives of each of the sub sections of the Village Pump. I'd rather not simply make the edit against the actions of another admin, so I'll contact MZMcBride to see what he thinks. Tra (Talk) 00:07, 12 January 2008 (UTC)

MrKIA11: I can say with certainty that this isn't the first template I've come across. : - ) Tra is free to implement this code, and you're free to re-activate the editprotected request, however, I will say that this template is border-line high use and its size will jump by about 10,000 bytes if it is updated. #ifexist is an incredibly helpful ParserFunction, though using it in this particular template probably isn't the best idea. As I said before, deprecating this template seems like a wiser choice to me, however, it's not my opinion that really matters here, and frankly, I don't really care about this template and its inner workings. Upon further review of the template, other than the increased size, it seems like perfectly fine code. It's a shame that #ifexist isn't more efficient, but eso es la vida. --MZMcBride (talk) 03:26, 12 January 2008 (UTC)

I was just commenting on the fact that you said There really isn't a compelling reason for #ifexist to not be used at the moment., even though it was in the sandbox code, and that you said rel2abs can cause serious issues when mixed with a CSS hack, even though it is in the current code. I agree that the size is a problem, which is why I originally suggested just having the links be a multiple of 5. This also makes me wonder why previous suggestions that make it smaller, such as the above section, were shot down. MrKIA11 (talk) 04:24, 12 January 2008 (UTC)
  Done and added a note on the documentation about the performance impact.
With regard to the previous suggestions referred to, whilst making the template smaller is a good thing, if the changes requested introduce other problems then it is more likely they would be rejected because of that. Tra (Talk) 12:00, 12 January 2008 (UTC)
Thank you very much. MrKIA11 (talk) 13:46, 12 January 2008 (UTC)

{{editprotected}} I just noticed that every line was off by one number. I corrected the sandbox, could you please change the template. Thanks. MrKIA11 (talk) 14:23, 12 January 2008 (UTC)

  Done Tra (Talk) 15:09, 12 January 2008 (UTC)

Parameter UsageEdit


Could someone add:

{{void|{{Template:Archive list/root/{{#if: {{{root|}}}||un}}defined}}}}
{{void|{{Template:Archive list/nobr/{{#if: {{{nobr|}}}||un}}defined}}}}
{{void|{{Template:Archive list/links/{{#if: {{{links|}}}||un}}defined}}}}

to the end of the template, so that the parameter usage can be checked? MrKIA11 (talk) 18:29, 16 January 2008 (UTC)

  Done Tra (Talk) 18:54, 16 January 2008 (UTC)
The new preprocessor changed the way {{void}} works, so could those 3 be changed to {{voidd}}. Thanks, MrKIA11 (talk) 12:45, 11 February 2008 (UTC)
  Done--Patrick (talk) 13:43, 11 February 2008 (UTC)

Stops at 36Edit

When contained within another template, this seems to have a limit of 36. No archive links above that number are displayed. See Talk:Anarchism, talk:George W. Bush, Wikipedia talk:WikiProject Opera. They contain an experimental new talkheader template, {{talkheader4}}, which includes {{archive list}}. In talk:Anarchism, you can see that this is happening in other templates that make use of this template as well, since a separate archive box is also posted. Can anyone fill me in on what's going on?

PS I tested posting this template on its own without being contained in another template, and in that case it still doesn't display all archives, but it does go up to #39 instead of 36. Equazcion /C 02:25, 30 Mar 2008 (UTC)

I've done some tests and it appears that the problem seems to come from having too many nested ParserFunctions. Rewriting the template to check if a given block of archives exists before linking to them might solve the problem; I'll have a go at this later. Tra (Talk) 12:02, 30 March 2008 (UTC)
It looks like you fixed it, Tra. Great job, thanks! Equazcion /C 17:38, 30 Mar 2008 (UTC)

Redlink transclusionsEdit

{{editprotected}} Is there a reason why the template transcludes three non-existing template subpages which clutter up the "templates transcluded" list and look rather unsightly? I expect that it was (once upon a time) to enable the use of the parameters to be tracked, but is it now necessary? If not, removing them would tidy up countless edit screens. Happymelon 21:35, 11 April 2008 (UTC)

I was originally using them, so if no one else needs them, I don't mind removing them. MrKIA11 (talk) 23:03, 11 April 2008 (UTC)
Thanks - much tidier! Happymelon 12:49, 12 April 2008 (UTC)

Weird bugEdit

{{Archive list}} is transcluded into Wikipedia:Village pump/Archive header, which is then transcluded onto various pages, including Wikipedia:Village pump (proposals)/Persistent proposals/Archive 1 and Wikipedia:Village pump (proposals)/Persistent proposals/Archive 2. I just created Archive 2, and if you look at Archive 1, it lists both Archive 1 and Archive 2, but Archive 2 does not. I've cleared my cache, and it still shows that way. I don't even have an idea of where to start looking as to why it's doing this. Anyone smarter than I am with at least as much curiosity? (And template know-how?)--Aervanath lives in the Orphanage 19:30, 19 September 2008 (UTC)

They look fine to me. MrKIA11 (talk) 17:29, 20 September 2008 (UTC)
Hmm. They look fine to me, now, too. I guess the job queue hadn't caught up yet or something. Oh well, problem solved.--Aervanath lives in the Orphanage 11:15, 21 September 2008 (UTC)

Clearer output if no archives existEdit


If placed on a discussion page with no archives, this template produces:


This is not particularly clear. It would be better to have it say something like:

no archives yet (create)

-->{{#ifexist:{{#rel2abs:./Archive 1|{{{root|}}}}}||no archives yet ([[{{#rel2abs:./Archive 1|{{{root|}}}}}|create]])}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 26|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=0}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 51|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=25}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 76|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=50}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 101|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=75}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 126|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=100}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 151|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=125}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 176|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=150}}<!--
-->{{#ifexist:{{#rel2abs:./Archive 201|{{{root|}}}}}|{{Archive list/display25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=175}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=175}}}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=150}}}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=125}}}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=100}}}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=75}}}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=50}}}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=25}}}}|{{Archive list/check25|root={{{root|}}}|links={{#ifeq:{{{nobr|}}}|yes||{{{links|10}}}}}|nobr=yes|start=0}}}}<!-- 
{{template doc}}

--Gurch (talk) 11:45, 29 December 2008 (UTC)

That code won't work. What happens is it checks if archive 1 exists, puts in the text 'no archives yet (create)' if archive 1 doesn't exist but then it runs the rest of the template as normal, resulting in an output of 'no archives yet (create)1'. I've put the code you gave in Template:Archive list/sandbox for further testing. The impact of this change should be fairly limited, however, since this template is mostly used through {{Talkheader}} and a few archival templates. {{Talkheader}} only displays the list if archive 1 exists and the archival templates would generally only be put on pages that have archives. Tra (Talk) 13:49, 29 December 2008 (UTC)
I've fixed the code in the sandbox page, but another concern I have is that this will cause one extra #ifexist call in nearly every transclusion of the template, and its benefits will hardly ever be seen. I'm not sure this is really necessary. Tra (Talk) 14:08, 29 December 2008 (UTC)
Regarding the first of those, "so what?"; the limit to #ifexist use is 100, which this template comes nowhere near. Regarding the second, the intention after this change is made is to modify {{talkheader}} to display it always, so that there's a link there to create an archive if one doesn't exist yet. This makes the archiving process easier and reduces the likelihood of archives being created in the wrong place, which often happens (in particular people miss the space between the numbers, or use a lowercase 'a', or call the first archive just "Archive") so that they have to be moved in order to work with templates such as this one that rely on the archives being named in the standard way. I also made {{archive bar}}, which contains just the archive part of {{talkheader}}, so that pages which don't need the whole header (which is most of them) can use that; I think the layout is better than that of {{archive box}} unless something else about the archives needs to be said, which is rare.
Yes, good points.   Done Tra (Talk) 19:28, 29 December 2008 (UTC)

Link to archive indexEdit

How about checking for and adding a link to an archive index, e.g. "./Archive_Index"?
Apis (talk) 02:54, 3 February 2009 (UTC)

In a lot of places where this could be useful, there would already be a link to the archive index. If this was implemented, to avoid duplicate links, we'd need to have a bot take out any existing links to the archive index. Tra (Talk) 14:48, 3 February 2009 (UTC)

Proper list markupEdit

We should replace this template's (and its siblings') current, coma-separated markup with a proper list, styled to render horizontally, like lists in navboxes, thus:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

by using either {{Flatlist}} or applying class="hlist" and using wiki list markup, with asterisks. This will improve accessibility and more closely comply with HTML standards (strictly we should use hashes ("#") for an ordered list, but there's a dispute about how to display those horizontally). See also WP:HLIST. I'll add pointer to this discussion, from a page where the technicalities of how to do this are better understood. Andy Mabbett (Pigsonthewing); Andy's talk; Andy's edits 11:22, 15 November 2011 (UTC)


  Moved from Module talk:Archive list: {{3x|p}}ery (talk) 20:27, 23 February 2019 (UTC)

Mr. Stradivarius this is a great module! The only thing that seems to be missing is a way to make it display a max of one line or a max of ## archives from the end of the list... Currently, on Template:Teahouse questions navbox I'm using a workaround that is kind of hacky to accomplish my desired result and the code looks like: {{#invoke:Archive list|main|root=Wikipedia:Teahouse/Questions|start={{#expr:{{#invoke:Archive list|count|root=Wikipedia:Teahouse/Questions}}-9}}|sep=  }} Where it has to invoke itself again to get a count of the total archives and then perform a parser function to subtract nine (displays ten links) and start the list from there. Also, you'll see that I have a double non-breaking space as a sep -- I don't know if you coded in an easier way to do that like "none" or "space" or something else for those that don't know entity codes. Technical 13 (talk) 18:07, 3 July 2013 (UTC)

Yearly archive listEdit

Could someone make {{yearly archive list}} into a wrapper for this template? It's basically the same thing with less functionality. — Scott talk 22:07, 2 February 2014 (UTC)

Prefix parameter doesn't accept empty valueEdit

Setting |prefix= as empty isn't working. Compare:

{{archive list|root=User talk:Scott Martin/Signpost|start=2010|prefix=}}
→ no archives yet (create)
{{yearly archive list|root=User talk:Scott Martin/Signpost|start=2010|prefix=}}
2009, 2010, 2011, 2012, 2013

Scott talk 22:16, 2 February 2014 (UTC)

Template-protected edit request on 13 February 2015Edit

Could someone please wrap a <noinclude></noinclude> around the "Template for move" tag. This will prevent the notice to be appended to every single instance were this template is used as is currently the case. Thank you, Tvx1 (talk) 21:29, 13 February 2015 (UTC)

  Not done: Duplicate of the request at Template talk:Archive list long#Template-protected edit request on 13 February 2015. --Redrose64 (talk) 14:37, 14 February 2015 (UTC)

Merge in archive list longEdit

Hi, the TfD to merge in {{archive list long}} closed as merge, so I'd like to move forward with that. I propose adding a parameter "format" to differentiate between the "long" format and this format, and to use the exponential search algorithm used in the lua module of archive list long to minimise the #ifexists parser function calls. Pinging Mr. Stradivarius for the Lua part of the proposal. Martijn Hoekstra (talk) 12:08, 21 February 2015 (UTC)

Template-protected edit request on 16 May 2015Edit

  Moved from Module talk:Archive list: {{3x|p}}ery (talk) 20:27, 23 February 2019 (UTC)

@Alakzi and Mr. Stradivarius: I've made changes to the sandbox version of this module, in order to implement consensus reached in this TfD to merge {{Archive_list_long}} with {{Archive_list}}. These changes also obsolete Module:Archives. Please let me know if you have any questions. Essentially, I've added a function to detect whether the format should be long or short. If long, the format is output in table form to be identical to the to-be-deleted {{Archive_list_long}}. All testcases look fine. 1, 2, 3.

If you approve of the changes here, please migrate the sandbox version to mainspace. I will then make a request to migrate some changes on {{Archives}}, and the TfD mentioned above will be complete. Thanks! Mamyles (talk) 15:40, 16 May 2015 (UTC)

  Done — Martin (MSGJ · talk) 14:32, 18 May 2015 (UTC)

Someone check this pleaseEdit

  Moved from Module talk:Archive list: {{3x|p}}ery (talk) 20:27, 23 February 2019 (UTC)

I reapplied my buggy edit plus fix to Module:Archive list/sandbox. Please check, and apply if it seems good. Thanks. Anomie 04:36, 30 December 2017 (UTC)

Anomie, after a week of this lingering I don't think I'm the only one passing by this request. I'd love to help out but you don't give any clue as to what buggy-ness is being fixed, there's no testcases, and no clue which pages could be used in the template edit preview to show the effect of the change. There's no discussion here or at Template talk:Archive list to offer any clue either. Could you provide some more info to help us help you? Cabayi (talk) 11:51, 6 January 2018 (UTC)
I made the original edit so I could use this module to display the archives of my talk page, which are currently named from User talk:Anomie/Archives/2007 through User talk:Anomie/Archives/2017. With the current version of the module, it claims there are no archives because there is no User talk:Anomie/Archives/1, despite {{Archive list}} having a |start= to specifically say that 2007 is the first archive. Anomie 23:08, 6 January 2018 (UTC)
@Cabayi: Anomie 23:09, 6 January 2018 (UTC)
So, using Anomie's talk archives as the affected pages, if I edit {{Archive list}} and preview with User talk:Anomie, alter {{Archive list}} to use Module:Archive list/sandbox instead of Module:Archive list and preview again it should show the fix in action... Yep, looks good, doesn't affect previews of my talk (via User:Cabayi/arc) which has "standard" naming...   Done ~ Glad to be able to help out an editor whose tools we all rely on. -- Cabayi (talk) 13:00, 7 January 2018 (UTC)
Return to "Archive list" page.