This is the sandbox page for Wikipedia:Wikipedia Signpost/Templates/Article list maker (diff). |
This template uses Lua: |
This template can be used to create lists of Signpost articles. The Signpost articles can be filtered by tags, by date, and by page; can be sorted by date, page, or title; and can be outputted in formats specified by the user.
Premade templates to automatically generate informational tables from issues, months, et cetera can be found here:
Wikipedia:Wikipedia Signpost/Templates/Tables and subpages
|
---|
There are over 5000 Signpost articles, so the first step to making a list of them is to filter out the results that you don't need. Here are the parameters that you can use to do that:
page
- If you use this parameter, only the specified page will be outputted.date
- If you use this parameter, only articles for the specified date will be outputted.tags
- Use this parameter to filter the articles by tag. You can specify an unlimited number of tags, separated by commas.tagmatch
- If this is set to "all", then only articles that match all the tags specified in tags
will be outputted. Otherwise, articles matching any of the tags will be outputted.startdate
- Don't output any articles before this date.enddate
- Don't output any articles later than this date.author
- Only output articles by this author. This should be the username of the author, without the "User:" prefix (e.g. JPxG
).sortdir
- The direction to sort the articles in, either "ascending" or "descending". The default is "ascending".sortfield
- The field to sort the articles by. Valid options are "date", "page", and "title". The default is "date".start
- Skip X articles from the beginning of the list to be returnedlimit
- Limit the number of articles returned to a specified valueThis is the full template, with all possible parameters.
{{Wikipedia:Wikipedia Signpost/Templates/Article list maker | title = | page = | subpage = | fullpage = | tags = | tagmatch = | date = | startdate = | enddate = | author = | sortdir = | sortfield = | start = | limit = | rowformat = | rowtemplate = | rowseparator = }}
This template outputs a series of rows, formatted with data from the articles specified using the parameters in #Filtering articles above. It is up to you to specify what parameters appear when in each row. To do this, you have two options, a row format string, or a row template.
Whichever option you choose, you can use the |rowseparator=
argument to specify a custom separator for each row. As a special case, if you use |rowseparator=newline
, the separator will be a new line character.
Both row format strings and row templates take the same parameters, although their syntax is slightly different. Row format strings take parameters that look like ${parameter}
, and row templates take parameters that look like {{{parameter}}}
. The available parameters are:
date
- The article date, e.g. 2015-03-25
.page
- The page the article is found on, e.g. Wikipedia:Wikipedia Signpost/2015-03-25/News and notes
.title
- The article title, e.g. Wikimedia Foundation adopts open-access research policy
.subpage
- The subpage name the article is stored on, e.g. News and notes
.fullpage
- The page the article is found on. If any tags matched this article, the first one in alphabetical order is used as the fragment (the section link). If the user specified |tags=research
, this might be Wikipedia:Wikipedia Signpost/2015-03-25/News and notes#research
, and if they specified |tags=newsandnotes, research, wmf
it might be Wikipedia:Wikipedia Signpost/2015-03-25/News and notes#newsandnotes
.
Row format strings are specified with the |rowformat=
parameter. These strings take row parameters that look like ${date}
, ${page}
and ${title}
.
For example, the following code:
{{Wikipedia:Wikipedia Signpost/Templates/Article list maker | tags = esperanza | rowformat = * ${date}, ${subpage}: [[${page}|${title}]], by ${author} | rowseparator = newline }}
Produces the following output:
Row templates are specified with the |rowtemplate=
parameter. This must be the title of a template that is used to format the rows. Row templates take parameters that look like {{{date}}}
, {{{page}}}
and {{{title}}}
.
For example, Wikipedia:Wikipedia Signpost/Templates/Article list maker/Example has the content:
* {{{date}}}, {{{subpage}}}: [[{{{page}}}|{{{title}}}]]
And the code:
{{Wikipedia:Wikipedia Signpost/Templates/Article list maker | tags = esperanza | rowtemplate = Wikipedia:Wikipedia Signpost/Templates/Article list maker/Example | rowseparator = newline }}
Produces the following output:
While row templates require you to create an extra page, they have the advantage of allowing you to process the parameters with parser functions, etc. For example, you could include the code {{#time: Y | {{{date}}} }}
to output the year only.
If the filter parameters you specify result in no articles being selected, you can use the |noarticles=
parameter to specify the text to include where the articles would be. The default is the text "No articles found for the arguments specified".
Example:
{| class="wikitable" ! Articles {{Wikipedia:Wikipedia Signpost/Templates/Article list maker | tags = asdfasdfasdf | rowformat = {{!}}- {{!}} [[${page}|${title}]] | noarticles = {{!}}- {{!}} style="color: red" {{!}} No articles could be found for your search... | rowseparator = newline }} |}
Articles |
---|
No articles could be found for your search... |
The following is a (not exhaustive!) list of templates and use cases where this is a dependency.