Jump to content

Template:ANEWS archive nav/doc

From Wikipedia, the free encyclopedia

This template creates links to the previous and next versions of the administrators' newsletter on which this template is transcluded. By contrast, Template:ANEWS nav creates links to the previous and next versions of the most recent newsletter; that is, the newsletter for the current month.

This allows users to easily navigate chronologically through the newsletter archive via links on each newsletter.

Usage

[edit]
{{ANEWS archive nav}}

Example

[edit]

On Wikipedia:Administrators' newsletter/2018/1, the template would produce:

Previous archive Current archive Next archive
Wikipedia:Administrators' newsletter/2017/12 Wikipedia:Administrators' newsletter/2018/1 Wikipedia:Administrators' newsletter/2018/2

Definitions

[edit]

This is maybe the second time that I've used parser functions in a template, so I apologize for the rustiness of the implementation – it's rather difficult to read. Below are a few definitions that might aid in readability. Mz7 (talk) 05:37, 7 February 2018 (UTC)

this year = {{#titleparts: {{FULLPAGENAME}} | 1 | 2}}
this month = {{#titleparts: {{FULLPAGENAME}} | 1 | 3}}

previous year = {{#expr: this year - 1}}
previous month = {{#expr: (((this month - 2) + 12) mod 12) + 1}}

next year = {{#expr: this year + 1}}
next month = {{#expr: ((this month) mod 12) + 1}}

if this month == 1, then
    previous issue = [[Wikipedia:Administrators' newsletter/previous year/previous month]]
otherwise,
    previous issue = [[Wikipedia:Administrators' newsletter/this year/previous month]]

current issue = [[{{FULLPAGENAME}}]]

if this month == 12, then
    next issue = [[Wikipedia:Administrators' newsletter/next year/next month]]
otherwise,
    next issue = [[Wikipedia:Administrators' newsletter/this year/next month]]

See also

[edit]