Knowledge (XXG)

User:Yunshui/Templates for beginners

Source 📝

90: 328: 281: 243: 31: 105:<spanLucida Grande',Tahoma,Verdana,sans-serif; {{border-radius|3px}} background:#ECEEF5; text-align:center;">] <span>{{#if:{{{num|}}}|{{{num|}}} {{PLURAL:{{{num|}}}|user {{{1|likes}}}|users {{{1|like}}}}} this.|{{#if:{{{username|}}}|] likes this.|{{{1|Like}}}}}}}</span></span> 62:
You've no doubt seen at least some of the many templates - navboxes, infoboxes, boilerplate warnings, tags, notices and so-one - that are everywhere on Knowledge (XXG). You may even have used some of them yourself. This page is intended to give a brief, informal introduction to templates and how they
75:
No-one wants to spend ages typing up the same piece of information over and over again, yet on Knowledge (XXG), it's often necessary to add generic messages to article or talk pages. For this reason, we have templates which can be used to add commonly-used messages or formats with the minimum number
179:
copies the contents of the template to the destination page, and saves it there. Changes made to the template will not show up on the destination page; effectively, substituting a template is the same as copy-and-pasting the template code. To substitute a template, add
408:
Then create the text/image/box that you want to appear when the template is used. You can do this by copying the code of a similar template and changing the appropriate elements, or you can write it from scratch (you'll need to be comfortable working with
164:
creates a link showing the contents of the template page on the destination page. This means that changes to the template page will show up on the page where it has been used. To transclude a template, enclose its name in
266:
However, if the user being warned has edited several articles, it can be helpful to specify which article has been vandalised. To do this, we add the problem article as an additional parameter, using a
348: 301: 259: 472: 79:
Templates work by copying the contents of the template page onto the page where you place the template. This is known as "calling" the template. For example, adding the text
133: 428:). This is a subpage of the template which details how it should be used: what parameters are available, which pages it should be used on and so forth. 351:
to learn more about contributing constructively to this encyclopedia. It is not appropriate to discuss the size of your sausage on Knowledge (XXG).
127: 121: 46:
It contains the advice or opinions of one or more Knowledge (XXG) contributors. This page is not an encyclopedia article, nor is it one of
47: 139: 113:
Templates are used for a number of different purposes. Some of the most common types are as follows (a complete list can be found
402: 64: 425: 219:
exist to automatically substitute templates if this has not been done, but it is always preferable to do the work yourself.
332: 285: 247: 447: 394: 331:
Hello, and welcome to Knowledge (XXG). Although everyone is welcome to contribute to Knowledge (XXG), at least one of
284:
Hello, and welcome to Knowledge (XXG). Although everyone is welcome to contribute to Knowledge (XXG), at least one of
246:
Hello, and welcome to Knowledge (XXG). Although everyone is welcome to contribute to Knowledge (XXG), at least one of
195: 145: 161: 435:
tags to prevent the documentation from showing on the destination page when the template is called, thus:
398: 320:{{subst:uw-vandal|Sausage|It is not appropriate to discuss the size of your sausage on Knowledge (XXG).}} 51: 467: 166: 110:
you can see why it's preferable to simply call the template, rather than typing out the entire code.
344: 297: 255: 356: 410: 39: 363: 312: 268: 231: 405:
as an example), but for any "official" template, it is preferable to use the Template namespace.
176: 414: 211:, should only ever be transcluded. If you are not sure, go to the template page and check the 205: 421: 216: 212: 237:
template is a warning for vandalism, and produces the following when used (substituted):
114: 340: 293: 251: 461: 355:
Each template page provides a list of available parameters in its documentation (see
97: 84: 54:. Some essays represent widespread norms; others only represent minority viewpoints. 17: 389:
Although templates can have quite complex code, they can be created by any user.
304:
to learn more about contributing constructively to this encyclopedia. Thank you.
262:
to learn more about contributing constructively to this encyclopedia. Thank you.
227:
Many templates can be customised to give tailored information. For example, the
359:
for the example above). Some templates use named parameters; for example, the
308:
It is also possible to use multiple parameters, again separated by pipes. The
318:
template allows for additional text as a second parameter, so typing this:
136:: posted on user talk pages to discourage inappropriate editing practices. 381:. In such cases, place the information to be displayed after the = sign. 142:: added to articles to help readers find other pages relating to a topic. 336: 289: 87:
and copy the contents to the destination talkpage - giving you this:
442:
You can now use your template around Knowledge (XXG): call it using
397:. It is possible to create and host templates in userspace (many 148:: added to articles to collate basic information about a subject. 25: 201:
must always be substituted in order to work; others, like
96:. Since the markup text of even the comparatively simple 417:
button often to check what effect your changes have had.
347:
for any test edits you would like to make, and read the
300:
for any test edits you would like to make, and read the
258:
for any test edits you would like to make, and read the
130:: used to propose articles for deletion in various ways. 431:
Transclude the documentation to the template page. Use
124:: added to articles to highlight areas for improvement. 437:<noinclude>{{documentation}}</noinclude> 83:to a talkpage tells the software to go to the page 339:, did not appear to be constructive and has been 292:, did not appear to be constructive and has been 250:did not appear to be constructive and has been 157:There are two methods for calling a template: 8: 473:User essays on editing and building content 48:Knowledge (XXG)'s policies or guidelines 426:Template:Name of your new template/doc 275:, for example, gives us this message: 7: 395:Template:Name of your new template 52:thoroughly vetted by the community 24: 369:template uses parameters such as 326: 279: 241: 88: 63:work; for more information, see 29: 403:User:Yunshui/Userbox Yang style 184:in front of the name, like so: 335:, such as the one you made to 288:, such as the one you made to 1: 153:Transclusion or substitution? 393:First, start a new page at 273:{{subst:uw-vandal|Sausage}} 489: 186:{{subst:name of template}} 448:Name of your new template 401:are hosted this way, see 343:or removed. Please use 296:or removed. Please use 254:or removed. Please use 353: 306: 264: 108: 422:documentation subpage 324: 277: 239: 191:Some templates, like 102: 50:, as it has not been 171:{{name of template}} 413:, though). Use the 357:Template:Uw-vandal1 71:What is a template? 385:Creating templates 433:<noinclude> 333:your recent edits 286:your recent edits 248:your recent edits 196:Proposed deletion 100:looks like this: 60: 59: 480: 453: 452: 446: 438: 434: 380: 376: 372: 368: 362: 330: 329: 321: 317: 311: 283: 282: 274: 245: 244: 236: 230: 210: 204: 200: 194: 187: 183: 172: 106: 92: 91: 82: 33: 32: 26: 488: 487: 483: 482: 481: 479: 478: 477: 458: 457: 450: 444: 443: 436: 432: 387: 378: 374: 370: 366: 360: 327: 319: 315: 309: 280: 272: 242: 234: 228: 225: 208: 202: 198: 192: 185: 181: 170: 155: 104: 89: 80: 76:of keystrokes. 73: 56: 55: 44: 30: 22: 21: 20: 12: 11: 5: 486: 484: 476: 475: 470: 460: 459: 456: 455: 440: 429: 418: 406: 386: 383: 224: 221: 215:. A number of 189: 188: 174: 167:curly brackets 154: 151: 150: 149: 143: 137: 131: 125: 72: 69: 65:this guideline 58: 57: 45: 36: 34: 23: 15: 14: 13: 10: 9: 6: 4: 3: 2: 485: 474: 471: 469: 466: 465: 463: 449: 441: 430: 427: 423: 419: 416: 412: 407: 404: 400: 396: 392: 391: 390: 384: 382: 365: 358: 352: 350: 346: 342: 338: 334: 323: 314: 305: 303: 299: 295: 291: 287: 276: 270: 263: 261: 257: 253: 249: 238: 233: 222: 220: 218: 214: 213:documentation 207: 197: 178: 175: 168: 163: 160: 159: 158: 152: 147: 144: 141: 138: 135: 132: 129: 126: 123: 120: 119: 118: 116: 111: 107: 101: 99: 98:Template:Like 95: 86: 85:Template:Like 77: 70: 68: 66: 53: 49: 43: 41: 35: 28: 27: 19: 451:}} 445:{{ 415:Show preview 388: 367:}} 361:{{ 354: 349:welcome page 325: 322:gives this: 316:}} 310:{{ 307: 302:welcome page 278: 265: 260:welcome page 240: 235:}} 229:{{ 226: 209:}} 203:{{ 199:}} 193:{{ 190: 177:Substitution 162:Transclusion 156: 112: 109: 103: 93: 78: 74: 61: 37: 18:User:Yunshui 468:User essays 411:Wiki markup 375:|publisher= 345:the sandbox 298:the sandbox 256:the sandbox 38:This is an 462:Categories 223:Parameters 140:Navigation 420:Create a 399:Userboxes 364:cite book 313:uw-vandal 232:uw-vandal 146:Infoboxes 341:reverted 294:reverted 252:reverted 169:, thus: 134:Warnings 128:Deletion 81:{{Like}} 371:|title= 337:Sausage 290:Sausage 206:cleanup 122:Cleanup 424:(e.g. 379:|page= 182:subst: 40:essay 16:< 377:and 269:pipe 217:bots 115:here 94:Like 117:): 464:: 373:, 271:: 67:. 454:. 439:. 173:. 42:.

Index

User:Yunshui
essay
Knowledge (XXG)'s policies or guidelines
thoroughly vetted by the community
this guideline
Template:Like
Template:Like
here
Cleanup
Deletion
Warnings
Navigation
Infoboxes
Transclusion
curly brackets
Substitution
Proposed deletion
cleanup
documentation
bots
uw-vandal
your recent edits
reverted
the sandbox
welcome page
pipe
your recent edits
Sausage
reverted
the sandbox

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.