Simple Templates

From mw.mh370.wiki
Revision as of 10:40, 15 July 2025 by Grant (talk | contribs)
Jump to navigation Jump to search

Simple Templates

I view simple templates as those which do not use variables.

For the mh370wiki.net site I have a lot of useful components in the Template namespace. When these are transcluded into a page there is no need to include the namespace.

A Short Line

I frequently use a short line to separate parts of a page. The html horizontal line


is full width by default and has no significant white space before or after.

My ShortLine is simple and reusable:-

<includeonly><div style="margin-left:20%; margin-right:20%; margin-top:1em; margin-bottom:1em;"><hr></div></includeonly>

If there was nothing else on the source page then the includeonly tags would not be needed. But I have kept a few previous versions, where I adjusted the white space, between noinclude tags.

To use the ShortLine I just transclude it with this instruction:-

{{ShortLine}}

And the result is this:-



Sub-page List

I have used sub-pages a lot. Sometimes it is helpful to get a list of sub-pages somewhere on the top page, so I can see what exists; to easily link to and open a sub-page; to check that each sub-page is linked from a parent page.

To display the list of subpages I can just place this code at a suitable place on a parent page:-

{{SubpageList}}

The template looks like this:-

<hr>
<h5>Note: This article has sub-pages:-</h5>
<p>{{Special:PrefixIndex/{{FULLPAGENAME}}/}}</p>

FULLPAGENAME is a variable in MediaWiki. There is a list of 'magic words' and variables at https://www.mediawiki.org/wiki/Help:Magic_words


A Signature

To 'sign' an article with my name I just write:-

{{Signature}}

The template is simple:-

<p style="width:90%; margin-left: auto; margin-right: auto; font-size:1em;  text-align:right;"><u>Grant</u></p>

The result is at the end of this page.





Grant