Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Help:Magic words for beginners

From Wikipedia, the free encyclopedia
For more detailed information on magic words, seeHelp:Magic words.
This help page is ahow-to guide.
It explains concepts or processes used by the Wikipedia community. It is not one ofWikipedia's policies or guidelines, and may reflect varying levels ofconsensus.

Magic words are words surrounded bybrackets orunderscores which most often insert or display the current value of what they are called. These includeparser functions,variables andbehavior switches and are features ofwikitext. They are interpreted by the Metawiki software and are often used in templates so that they show different information depending on which page they are on and many other conditions.

Types

[edit]

There are three types of magic words:

  • Behavior switches: uppercase words surrounded by doubleunderscores, like.__NOTOC__
  • Variables: uppercase words surrounded bydouble braces, like{{PAGENAME}} and function somewhat similarly to templates.
  • Parser functions: These include expressions and consist of keywords (some beginning #) in double braces with parameters following a colon, ex.{{#expr:2+2}}

Things to remember

[edit]
A Notepad
Remember...
  • Most magic words may be case-sensitive.
  • Whitespace is not counted in from the front and back of keywords and parameters and the same also applies to template code.
  • "{{ Nofeed |Art=Wikipedia }}" and {{Nofeed|Art=Wikipedia}} will both succeed in producing the "Nofeed" template.
  • Page-dependent magic words will change or show information about the current page, even if the word is from a template, though in most cases, this is the desired effect.
  • If I insert {{exampletemplate}} and it says {{PAGENAME}}, I will see "Magic words for beginners" even though it is from "Template:example template".
  • If you want a magic word to paste in its value at the time of saving, you cansubstitute it in the same way that templates are substituted (using thesubst: keyword).
  • {{CURRENTTIME}} will always display the current time and remain as is, while {{subst:CURRENTTIME}} will result in, for example, 9:45 being inserted and always remaining as regular text.

Behavior switches

[edit]
A Magic Wand
The implementation of magic words

For a more detailed explanation, refer to thebehavior switches MediaWiki page.

Table of contents

[edit]
  • __NOTOC__ (can be placed anywhere in the wikitext; prevents a table of contents)
  • __FORCETOC__ (can be placed anywhere in the wikitext; makes a table of contents appear in its normal position)
  • __TOC__ (places a table of contents at its position)

Edit/section links

[edit]
  • __NOEDITSECTION__ (hides section edit links beside headings)
  • __NEWSECTIONLINK__ (adds a "+" or "new section" link for adding a new section on a non-talk page)
  • __NONEWSECTIONLINK__ (removes the "+" or "new section" link on "Talk" pages)

Categories and indexing

[edit]
  • __NOGALLERY__ (on category pages, replaces thumbnails with normal links)
  • __HIDDENCAT__ (on category pages, makes it ahidden category)
  • __INDEX__ (tells search engines to index the page (show in results))
  • __NOINDEX__ (tells search engines not to index the page (not show in results))

Titles and sorting

[edit]
  • {{DISPLAYTITLE:title}} (changes thedisplayed form of the page title)
  • {{DEFAULTSORT:sortkey}} (sets a default categorysorting key)

Variables

[edit]
The Square Root of x
A variable in math
A mathematical plot.
A plot of variables in algebra.
(Though magic words are much easier!)

For documentation, you may wish to read thevariables MediaWiki page.

  • Shown here: Help:Magic words for beginners (Ex.User:QwerpQwertus/Adoption)
  • {{PAGENAME}} (page title without namespace)
  • Shown here: Magic words for beginners (Ex. User:QwerpQwertus/Adoption)
  • {{BASEPAGENAME}} (the page title without the currentsubpage or namespace — the parent page without the namespace.)
  • Shown here: Magic words for beginners (Ex. User:QwerpQwertus/Adoption)
  • {{SUBPAGENAME}} (subpage part of title)
  • Shown here: Magic words for beginners (Ex. User:QwerpQwertus/Adoption)
  • {{SUBJECTPAGENAME}} (associated non-talk page)
  • Shown here: Help:Magic words for beginners (Ex. "Talk:Wikipedia" makes "Wikipedia")
  • {{TALKPAGENAME}} (associated talk page)
  • Shown here: Help talk:Magic words for beginners (Ex. "Wikipedia" makes "Talk:Wikipedia")
  • {{NAMESPACE}} (namespace of current page)
  • Shown here: Help (Ex. User:QwerpQwertus/Adoption makes "User")
  • {{SUBJECTSPACE}}, {{ARTICLESPACE}} (associated non-talk namespace)
  • Shown here: Help, Help (Ex. User talk:QwerpQwertus/Adoption makes "User")
  • {{TALKSPACE}} (associated talk namespace)
  • Shown here: Help talk (Ex. "Wikipedia" makes "Talk:Wikipedia")
  • {{FULLPAGENAMEE}}, {{NAMESPACEE}} etc. (URL-encoded equivalents)
  • Shown here: Help:Magic_words_for_beginners (Ex. "Wikipedia" makes "http://en.wikipedia.org/w/index.php?title=Wikipedia")

See also

[edit]

For more detailed information on all magic words (behaviour switches, variables and parser functions), consider reading:

About Wikipedia (?)
Help for readers (?)
Contributing
to Wikipedia
 (?)
Getting started (?)
Dos and don'ts (?)
How-to pages and
information pages (?)
Coding (?)
Directories (?)
General
technical help
Special
page
-related
Wikitext
Links anddiffs
Media files: images,
videos and sounds
Other graphics
Templates and
Lua modules
Data structure
HTML andCSS
Customisation
and tools
Automated editing
Retrieved from "https://en.wikipedia.org/w/index.php?title=Help:Magic_words_for_beginners&oldid=1314361951"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp