Help:Displaying a periodic featured article


If you're familiar with Wikipedia, you may wish to have your wiki emulate their style by including a daily featured article on your Main Page (or somewhere else, such as on a wikiproject page). You can do this by transclusion, which is automatically copying the contents of one article into the body of another. (Your featured article text is said to be transcluded into the page where it is to appear.) This is largely a manual process, except that the wiki markup on the page where the transclusion is to be displayed can be automated.



You'll need three elements to make the process work. The first is the callout to the transclusion; the second is the transclusion itself; and the third is the actual featured article.

Calling the transclusion

First, on the page where the featured article will be displayed (the display article), write a template to transclude the text of another article, something like this:

{{:Today's featured article/{{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}}}

This callout has several important elements:

  • The outside set of double braces ( {{}} ) calls for a transclusion. By default this would be a call to a template page (in the Template: namespace), but in this case...
  • The colon ( : ) specifies the (Main) namespace, which is where most articles are located. You could specify any namespace you wish by explicitly writing it in, but for this purpose, (Main) is probably the best choice.
  • The text "Today's featured article" identifies the transclusion's parent article.
  • The slash ( / ) indicates a subarticle of Today's featured article.
  • The text {{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}} identifies the specific subarticle. It does this by using magic words that fill in the month name, day of the month, and year when the page is displayed. For example, using the same magic words, today is October 27, 2021.

The result is that the display article looks for a transclusion in an article named "Today's featured article/Month dd, yyyy" (where Month, dd and yyyy vary with the current date). If it finds the article, it transcludes it. Otherwise, it creates a redlink to it.

Using a similar process, you could create a featured article that occurs less frequently. For instance, the text

{{:Today's featured article/{{CURRENTMONTHNAME}}, {{CURRENTYEAR}}}}

would give you a monthly featured article.

Writing the transclusion

The transclusion is not the same as the article it is written about. Instead, it's a short blurb about the article, and it ought to include a link to the full article. Using the code above, the featured article transclusion for today would go into an article named Today's featured article/October 27, 2021.

You (or anyone else editing your wiki) must write the text of the transclusion. Ideally it ought to be written and ready for display well in advance of the date it's supposed to appear; otherwise, people viewing the display page on the day it's supposed to appear will see a redlink to the unwritten transclusion. You can include whatever you want, including pictures or links to other articles.

There are two HTML-style tags that you should be aware of when writing a transclusion:

  • <noinclude> and </noinclude> go around text that is used when viewing the transclusion directly, but that will not be used when it is transcluded into another article. For example, you can put a Category link inside <noinclude> tags to categorize the transclusion but not the display article.
  • <includeonly> and </includeonly> are just the opposite of <noinclude>. These tags go around text that applies to the display article but not the transclusion itself when directly viewed. For example, you could put a Category link inside <includeonly> tags to categorize the display article but not the transclusion.

About the featured article

The process of selecting an article as a featured article is up to you. You might decide unilaterally or arbitrarily which articles are to be featured, or you could set up a committee of editors, or open it up for your entire wikicommunity to offer input, suggest notable articles, and vote on which ones are best. Use whatever process is right for you.

Personal tools