Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 00:08, 17 August 2025 by imported>Nerdyguy2000 (Small fix ;))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Message box

Template documentation (for the above template, sometimes hidden or invisible) [view] [edit] [history] [refresh]

Template:Documentation header

Based on Template:W

Usage

Before setting up automatic archiving on a high-traffic article's talk page, please establish a consensus that archiving is necessary there.

If you are unsure what code to use, a suggestion: go to #Example 2: Incremental archives and have a look at its copy paste section.

Setting up archiving

Put the following template at the top of the page that you want automatically archived:

Template:Warning

<syntaxhighlight lang="wikitext"> Template:AutoArchive </syntaxhighlight>

Well, maybe not exactly that (read about required options below), but that's how it's done. By the way, the template has no content and is template protected, so don't worry about visual appearance.

The bot expects to see exactly one parameter per line. The closing }} must be on its own line. There must be no leading spaces before the pipes, and no blank lines. If you drop out the newlines used in the above example, e.g. by wrapping the template invocation onto a single line, the bot may not do what you expect.

Also, the template must be located:

  1. before the first ==second level header== on the page
  2. on the actual page and not transcluded from a subpage, such as a page header, etc.

Quick examples

To get the hang of it – configuration may not be intuitive, but it's flexible and gives potentially vast possibilities.

Please change "User talk:Example" to the exact name of your own page!
If it's still not working, read about the "minthreadsleft" and "minthreadstoarchive" parameters below.

Example 1: Static archive

Template:Warning

<syntaxhighlight lang="wikitext"> Template:AutoArchive </syntaxhighlight> (Note: this is an example and this exact code won't work on your page.)

This setup archives threads from User talk:Example to User talk:Example/Archive after they are 7 days old (counting from newest timestamp). The archive will freeze when it becomes 2000 KB large. It is probably not a useful config (unless for sending threads to a periodically cleaned trash bin or to decide yourself when to go to the next archive page), but it is easiest, so it is mentioned first.

Example 2: Incremental archives

<syntaxhighlight lang="wikitext"> Template:AutoArchive </syntaxhighlight> The "Example" code above won't work as is; please substitute in your userid, or just copy-paste the code below!

Note that for the default skin on this wiki, a minimum of 4 threads is required for a table of contents (TOC) to show up automatically.

Copy and paste for easy use: <syntaxhighlight lang="wikitext"> Template:AutoArchive </syntaxhighlight> This tells the bot to archive threads over thirty days old (leaving the four most recent) from User talk:Example to User talk:Example/Archive 1 (more about variables below) until it fills up to 150 kilobytes, whereupon the bot will move to 2 (updating the counter when saving page). Remember to specify the maximum size of an archive, or it will behave pretty much like in the first example. In addition, each archive page is given a Template:Tl banner, which makes it easy to move between the different archive pages.

Example 3: Date-based archives

Template:Warning

<syntaxhighlight lang="wikitext"> Template:AutoArchive </syntaxhighlight> Note: please substitute in your userid, or just copy-paste the code below!)

Copy and paste for easy use: <syntaxhighlight lang="wikitext"> Template:AutoArchive </syntaxhighlight> In this configuration, threads older than 5 days will land in archives depending on their date (that is newest timestamp). You can read about other variables below.

Parameters explained

Note: For those parameters with defaults they will work regardless of whether they are listed on the talk page. But it is better to list all those parameters (with values of your choice) to avoid confusion. See this discussion.

<syntaxhighlight lang="wikitext"> Template:AutoArchive </syntaxhighlight>

Parameter Default Description
archive N/A; required Name of the page to which archived threads will be put. This parameter supports the use of variables, which can be used to create dynamically named archives (such as using date ranges). Note that magic words and templates do not work with this parameter, and unless a key is supplied (see below), the target page must be a subpage of the current page. Otherwise Category:Pages where archive parameter is not a subpage is added.
algo old(24h) Minimum amount of time that must pass after the last reply before the bot can archive the thread. It must be in the form: old(nT) where n is a number and T specifies hours or days. You can leave out T to specify seconds (even there's essentially no use case for that). Examples: 600, 72h, 5d would specify either 600 seconds, 72 hours or 5 days respectively. To specify very long timespans, use days. For example; algo=old(1100d) for close to three years. Complex formulas (including regex matching) may be available in the future.
counter 1 The current number of the last archive. If the %(counter)d variable is not used, it is ignored. ArchiveBot updates this parameter as necessary.
maxarchivesize 1954K The maximum archive size in either raw text size (eg 256M for megabytes, 256K for kilobytes, or 256B for bytes) or threads (eg 10T) before incrementing the counter. A bare integer will be interpreted as bytes. Ignored if counter is not used.
minthreadsleft 1 The minimum number of threads that the bot will leave on a page. Setting this value to 0 can result in pages getting completely harvested/emptied out. Note that if the bot leaves fewer than 4 threads, a table of contents will not show up automatically on Vector 2010.
minthreadstoarchive 2 The minimum number of threads to archive at one time, which is used to lower edit frequency. ArchiveBot does not archive threads when fewer than the value of this parameter would be archived. If this parameter setting is left out the default is 2. This can confuse editors. Please fill in the value.
archiveheader Template:Tl Content that will be put on new archive pages as the header. This parameter supports the use of variables.
key A top-secret key that (if valid) allows archives to not be subpages of the page being archived. To obtain such a key, request it from this editor, and you better have a very good justification for doing so.

Variables

Variable parameter Expands to...
%(counter)d the current value of the counter
%(year)d year of the thread being archived
%(month)d month (as a number 1-12) of the thread being archived
%(monthname)s English name of the month above
%(monthnameshort)s first three letters of the name above

Those python-savvy people will immediately recognize these variables are filled at runtime with the % operator and should know how to adjust the format. A few points of interest to others:

  • make sure you don't mess up the last letter after the brackets (it's "d" for integers and "s" for Template:W)
  • integer variables may be left-padded with zeros:
    %(counter)03d evaluates to 013 if the counter's value equals 13,
    %(month)02d becomes 05 for May etc.

After you have set up archiving

The bot runs once a day at a preset hour. Simply wait for the next cycle and you should see the bot's entries in the history list of your article providing there was anything to archive, and the history list entry should provide a link to the archive page you specified.

You can use the {{Archive box}} template at the top of a page to show a list of archive subpages, and it includes a search box. However, you must maintain the contents of this box manually.

A related but distinct function is templates that appear in the archived talk pages themselves. For instance:

Missing signatures

One potential problem is that ArchiveBot does not archive sections that have no signatures. However, editors sometimes forget to sign a comment so it may ignore old sections while archiving more recent ones.

One option is to manually archive sections that are unintentionally unsigned. The one click archiver can help. The other option, which allows ArchiveBot to archive an unsigned section is to add a signature of the editor to the last comment in the section.

You can add missing signatures to the talk page by using the templates Template:Tl or Template:Tl. Only the last comment added to a section needs to have a signature for ArchiveBot to archive the section.

Template output

When parameter |key= is provided, the only output of the template is categorization into Category:Pages archived using a key. Otherwise, the template outputs a single self closed tag <nowiki />. This is a trick, which makes it easier to deal with potential vertical white-space issues.

Causes of no archiving

Some of the possible reasons for a page not being archived:

  • |archive= does not specify a subpage of the page to be archived. This can for example happen after a move where the parameter needs updating.
  • Archive bot has not run. Archiving usually runs once a day. See the latest activity at Special:Contributions/ArchiveBot.
  • |minthreadstoarchive= is larger than the current number of sections ready for archiving.
  • |minthreadsleft= is too large to currently allow any archiving.
  • |algo=old(...) is currently too long for any archiving.
  • The archiving instructions are not placed somewhere before the first section heading.
  • The archiving instructions are placed within another template's code.
  • The parameters are not arranged with exactly one per line.
  • If some sections are archived but not others then they may have no signature with a valid time stamp. Please see #Missing signatures above.
  • If your talk page's title contains certain punctuation characters ("&'). Please see Template:W for an explanation and solution.
  • If the topic has no subject line, such as welcome messages.
Template:Sandbox other
The above text is transcluded from Template:MC/AutoArchive/doc; you can change it or view its history.
If you're done making changes, please refresh the text.
Please add categories and interwikis to Template:MC/AutoArchive/doc. (View all subpages of this page.)