This is a documentation subpage for 模板:Webarchive. It may contain usage information, categories and other content that is not part of the original 模板 page. |
This template is used on many pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
{{Webarchive}}
is for linking to web archiving services such as the Wayback Machine, WebCite and all other web archiving services.
This template is a replacement for {{wayback}}
, {{webcite}}
, {{memento}}
and {{cite archives}}
, as decided in this discussion.
Note: The most common method for linking a web archive are the CS1|2 templates such as {{cite web}}
with the |archive-url=
, |archive-date=
, and |url-status=
parameters. Please be aware of WP:CITEVAR before converting this template to a CS1|2 template.
Usage
In most cases the template needs only two parameters, the archive |url=
and archive |date=
. It is also common to include a |title=
. For some URLs, the template can automatically display the date. To prevent the template from adding a wikilink to the name of the web archiving site, use the |nolink=
parameter with any value.
- Usage with
|url=
and|date=
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |date=2 August 2016}}
- Archived 2 8月 2016 at the Wayback Machine
{{webarchive |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |date=12 February 2009}}
- Archived 12 2月 2009 at WebCite
- Usage with
|url=
and|title=
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |title=Page title}}
- Page title at the Wayback Machine (archived 2016-08-02)
{{webarchive |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |title=Page title}}
- Page title at WebCite (archived 2009-02-12)
- Usage with
|url=
,|date=
and|title=
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |date=August 2, 2016 |title=Page title}}
- Page title at the Wayback Machine (archived 8月 2, 2016)
{{webarchive |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |date=February 12, 2009 |title=Page title}}
- Page title at WebCite (archived 2月 12, 2009)
- Usage with
|url=
,|date=
and|nolink=
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |date=August 2, 2016 |nolink=y}}
- Archived 8月 2, 2016 at the Wayback Machine
{{webarchive |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |date=February 12, 2009 |nolink=1}}
- Archived 2月 12, 2009 at WebCite
Multiple URLs
The template optionally supports multiple URLs (up to 10) for linking to multiple archiving services for the same source link. The first url argument is |url=
then |url2=
.. |url10=
. Each URL can have its own date and title argument, thus |date2=
.. |date10=
and |title2=
.. |title10=
.
Parameters
Main parameters
- url..url10
- The URL(s) to the archive service. There should always be a
|url=
which counts as the first url. Each|url#=
can have its own numbered corresponding|date#=
and|title#=
. Matching of URL with date and title is done by numbers, not position. Numbers do not need to be in sequence, for example|url2=
followed by|url5=
works. - date..date10
- The date the page was archived. The date format displayed is the same as entered. If
|date=
is missing the template will make a best effort to find the date by decoding the archive URL (wayback and webcite for example provide this data in the URL), and will display the date in iso format by default. However including a date is recommended for date formatting reasons, and because other tools may not have the ability to decode the date from the URL. - title..title10
- The text displayed for the link. If no
|title=
is provided then|date=
is displayed. Otherwise|title=
takes precedence if both are set.
Secondary parameters
- nolink
- If set to any value, the archive service name will not be wikilinked.
- format
- This is a special option to support the merger of
{{cite archives}}
. It may be deprecated in the future. Because CS1|2 templates do not currently support more than one archive link, this template will tack on additional archive links to the end of a CS1|2 template output. It takes two values:|format=addlarchives
or|format=addlpages
. Addlarchives will display output appropriate for linking to multiple web archiving services. Addlpages will display output appropriate for linking to multiple pages at the same archive.
Examples
The number of possible examples is extensive depending on the mix of options. Some common cases follow. For more extensive testing see the testcases page.
- Single link at Wayback Machine with date and title (recommended method)
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |date=August 2, 2016 |title=Page title}}
- Page title at the Wayback Machine (archived 8月 2, 2016)
- Single link at Wayback Machine with date only
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |date=August 1, 2016}}
- Archived 8月 2, 2016 at the Wayback Machine
- Single link at Wayback Machine with title; date extracted from URL
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |title=Example}}
- Example at the Wayback Machine (archived 2016-08-02)
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |title=Example |date=mdy}}
- Example at the Wayback Machine (archived 8月 2, 2016)
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |title=Example |date=dmy}}
- Example at the Wayback Machine (archived 2 8月 2016)
- Single link at WebCite with title; date extracted from URL
{{webarchive |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com |title=Example}}
- Example at WebCite (archived 2009-02-12)
{{webarchive |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com |title=Example |date=mdy}}
- Example at WebCite (archived 2月 12, 2009)
{{webarchive |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com |title=Example |date=dmy}}
- Example at WebCite (archived 12 2月 2009)
- Single link at archive.today with title; date extracted from URL
{{webarchive |url=https://archive.today/2016.08.08-112330/http://example.com |title=Example}}
- Example at archive.today (archived 2016-08-08)
{{webarchive |url=https://archive.today/2016.08.08-112330/http://example.com |title=Example |date=mdy}}
- Example at archive.today (archived 8月 8, 2016)
{{webarchive |url=https://archive.today/2016.08.08-112330/http://example.com |title=Example |date=dmy}}
- Example at archive.today (archived 8 8月 2016)
- Multi-link at Wayback Machine with dates and titles (recommended method)
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |title=Page title |date=August 2, 2016 |url2=https://web.archive.org/web/20160902000046/http://example.com/ |title2=Page2 title |date2=September 2, 2016}}
- Page title at the Wayback Machine (archived 8月 2, 2016). Additional archives: Page2 title.
- Multi-link at Wayback Machine with dates only
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |date=August 2, 2016 |url2=https://web.archive.org/web/20160902000046/http://example.com/ |date2=September 2, 2016}}
- Archived 8月 2, 2016 at the Wayback Machine. Additional archives: September 2, 2016.
- Multi-link at Wayback Machine with titles only
{{webarchive |url=https://web.archive.org/web/20160802001301/http://example.com/ |title=Page title |url2=https://web.archive.org/web/20160902000046/http://example.com/ |title2=Page2 title}}
- Page title at the Wayback Machine (archived 2016-08-02). Additional archives: Page2 title.
- Additional archives format
{{webarchive |format=addlarchives |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |date=12 February 2009}}
- Additional archives: 12 2月 2009.
- Additional pages format
{{webarchive |format=addlpages |url=https://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |url2=https://web.archive.org/web/20160902000046/http://example.com/ |date=12 February 2009}}
- Additional pages archived on 12 2月 2009: Page 1, Page 2.
Tracking categories
The template has a number of hidden tracking categories which may be added (via Module:Webarchive):
Tracking archive sites
- Category:Webarchive template wayback links (7): links to Wayback Machine
- Category:Webarchive template archiveis links (2): links to Archive.today
- Category:Webarchive template webcite links (1): links to WebCite
- Category:Webarchive template other archives (0): links to known archive sites that don't have their own tracking category
- Category:Webarchive template unknown archives (0): the template doesn't recognize the archive URL; this may indicate an error in the data; or the template itself needs updating to reflect a new archive site
Tracking warnings and errors
- Category:Webarchive template warnings (1): soft errors that do not prevent the template from working but leave a red message
- Category:Webarchive template errors (5): errors typically requiring human intervention
Template maintenance
The following can be done to maintain the template.
Monitor tracking categories
- The tracking categories for "warnings" and "errors" can be monitored to alert for any problems in the data.
- The tracking category for "unknown archives" may indicate a problem in the data; for example an editor used the source URL instead of the archive URL in the
|url=
field.
Monitor template argument usage
This tool shows which instances of the template are using which arguments—it might show, for example, that |access-date=
is being used by five instances in five articles. Since this is an error (the template does not support |access-date=
) those five template instances should be fixed to remove the |access-date=
.
Configuration: verifydates
The template can verify that dates in URLs for Wayback, WebCite, and Archive.is match the date in the |date=
argument. If the dates do not match it will display the date from the URL, add a red warning message "date mismatch", and add the article to the warning tracking category.
Because the verification function adds some overhead to the template, it can optionally be globally disabled by setting the variable "verifydates = no" (see the Module source in function p.webarchive()). Note that after setting to "yes", it can take a week or more for the tracking category to be fully populated. Set to "yes" if you are searching for problems in the data that need fixing (they'll show up in the tracking category).
Configuration: maxurls
The max number of URLs is 10 but this can be changed by setting the "maxurls" variable in the p.webarchive() function. This is a global variable that will affect all instances of the template, use with caution. Reducing the number will increase the template speed and reduce resource use.
TemplateData
TemplateData for Webarchive
A template for linking to offsite archives such as Wayback, WebCite, Archive.is, etc..
参数 | 描述 | 类型 | 状态 | |
---|---|---|---|---|
Archive URL | url | URL to the archive.
| 字符串 | 必需 |
Archive date | date | Date of the archive.
| 字符串 | 推荐 |
Archive title | title | Title (or text) displayed on the Wiki page for the link.
| 字符串 | 推荐 |
Wikilink | nolink | Wikilink to the archive's page in the rendering. Any value including blank means no wikilink. | 字符串 | 可选 |
Format of template rendering. | format | For multi-URL instances, render display in one of two formats. | 字符串 | 可选 |