Knowledge (XXG)

Template:Anchor

Source đź“ť

21: 129: 86: 513: 52: 871:
be able to quickly access the section of your article on Yish Yash tongue placement when forming vowels; however, you don't want to send them to the beginning of the whole article on the Yish Yash language (you wanted to target them more specifically). So you create a link in the Proto-Indo European vowel article to the
939:
of the Yish Yash article, even if the wording of the section heading there had changed completely and without the reader having to sort it out for themselves. The use of anchors can make for a cleaner, more efficient Knowledge (XXG) reading experience where section headings are changed—which they not
870:
Let's say that you then finished up writing and saved the new article. Now, say you came across another article on Knowledge (XXG) titled "Proto-Indo-European vowels" which happened to have a section on the unique tongue placement used in Yish Yash. You decided it might be useful here for readers to
861:
Say you wrote an article about a recently discovered Indo-European language called "Yish Yash". The title of your article would probably be "Yish Yash language" (if there were already an article titled "Yish Yash" that covered the culture generally). Now let's say that within your article you wished
612:
is placed at the start of a vertically centered cell (which is the default for tables) then links to the anchor will jump to the start of the displayed content and not the top of the cell. This may require the reader to scroll up to fully see other cells in the row. It can be avoided by instead
204:
Anchors are most useful with sections, since links to a section will not work if a section is renamed. However, anchors can be used as needed anywhere in an article. The anchor name can be arbitrary, but the first letter should generally be capitalized in keeping with header style (see
897:
Now let's say another editor came along and wished to change the heading of this section of your article for some legitimate reason—perhaps to "Yish Yash vowels and the tongue". They could do so by editing your article and making the section heading look like
415:
Anchor names that contain any character shown in the table on the right will not work as expected. However, any of these characters can be replaced with the "&#" codes shown for them here. Or, the pipe symbol and equals sign can be worked around with
536:
template may be used in the caption and cells of a table, but not those portions of a table that are outside the caption and cells. Unlike in section headings, the template does not have to be substituted. It is used on the table's caption thus:
906:
Unbeknownst to that editor, this would mean the link in the article on Proto-Indo-European vowels that you created earlier would now go by default to the top of the Yish Yash article instead of your carefully-chosen subsection! However, if an
499:. The editor must manually remove the anchor template from the edit summary window, or else when they save the section, the browser may not return to the section and the section link of that edit in the history page won't work. 683:
has been placed above the section header. This anchor does work correctly for standard desktop skins, but because the anchor is technically not in the section but before it, mobile views will not expand the desired section.
593:{| id=FooX class=wikitable |- id=FooY !id=Foo1 |A header cell !style="background:white;" id=Foo2 |A header cell with styling |id=Foo3 |A data cell |rowspan=2 id=Foo4 |A data cell spanning two rows 772:
section) is that having a template in the section header causes problems with the edit summary window each time that a section edit is done for this section. The obvious solution is to place the anchor
581:!{{anchor|Foo1}} |A header cell !style="background:white;" {{anchor|Foo2}} |A header cell with styling |{{anchor|Foo3}} |A data cell |rowspan=2 {{anchor|Foo4}} |A data cell spanning two rows 549:!{{anchor|Foo1}} A header cell !style="background:white;" |{{anchor|Foo2}} A header cell with styling |{{anchor|Foo3}} A data cell |rowspan=2 |{{anchor|Foo4}} A data cell spanning two rows 670:
has also been placed underneath the Basic format section header and can be clicked to illustrate how this placement hides the section title when jumping to the linked target on some web browsers:
879:
article on the placement of the tongue in Yish Yash: you might do so by editing the text of the Proto-Indo-European vowel article and adding something like this to a relevant place within it:
730:
articles and from redirects (where the ellipsis after the word "Foo" here means the words chosen to represent that link in the Knowledge (XXG) article, which, of course, could be anything).
889:
long code, but it would create a direct link to the relevant section of the new Yish Yash language article and would look like this in the article on Proto-Indo-European vowels:
1269: 911:
were placed within the section heading of the Yish Yash article either when you created it or when the other editor came along and changed it—perhaps something like this:
147: 142:
If you intend to change this template in any significant way, move it or nominate it for deletion, please inform the bot operators. Thank you. The relevant bots are:
258:
are not equivalent. When making an anchor, in general capitalize the first letter of the anchor name, and follow the same capitalization guidelines as headers (see
1264: 451:
links go to the first anchor with that name. Duplicate anchors result in invalid HTML; you can check for duplicate anchors by running the page through the
1231: 979:
Add HTML anchors to a page. Make a link to your anchor with ] or ]. Every anchor on a page must be different. Do not use the characters " or # or | or =.
862:
to have a section titled "The placement of the tongue when producing Yish Yash vowel sounds". You would create a section heading that looked like this:
1274: 1216: 1204: 36: 733:
Anchors can be more suitable for inter-article linking than section titles are, because anchors are more stable. For example a section title
1243: 1200: 32: 447:
Anchor names must be unique on a page, and must not duplicate any heading titles. Duplicate anchors will not work as expected since the
1186: 478:
case-sensitive, do not create section titles or anchors that differ only in case from others on the page. That is, do not create both
221:
You can define one or more anchor names, separated by |. This can be useful for alternative spellings, such as "humor" and "humour."
462:
browsers, so treat all anchor links as case-sensitive when creating links to them. For example, if you create the anchor with
444:(superscript and subscript) cannot be used. Most other characters, including white space and punctuation, are not a problem. 452: 40: 1259: 493:), then the template code will appear in the edit summary window each time a section edit of that section begins, as in 698:
Reasons for the above being best practice are detailed in the following additional, numbered examples, as well as in
644:
To show why placement in the header is preferred, the following anchor is placed in the Basic format section header:
962: 637:
is used without substitution, the anchor will be included in page editing history as part of the section name (see
276: 1226: 519: 107: 958: 950: 794: 589:
attribute. This is placed in that portion of the markup where the classes, styles etc. may be used, as follows:
1211: 1143: 1121: 777:
the section. This also prevents browsers from hiding the section title from view when jumping to the target.
647:== Basic format<span class="db-YW5jaG9y"></span><span class="db-YW5jaG9y"></span> == 103: 111: 1132: 954: 927:
and the text of the article on Proto-Indo-European vowels had been changed by you to something like this:
1175: 69: 601:
attribute may appear before, between or after any other attributes that may be present, but only one
115: 585:
If it is necessary for an anchor to be in any of these positions, a different technique is used—the
1239: 1194: 162: 28: 1167: 1162: 181: 793:
Within section titles, it may be preferable to simply use direct HTML, which may be achieved by
229: 195:
software to (usually) direct users to sections within a page, is not a wikitext directive like
114:. The tested changes can be added to this page in a single edit. Please discuss changes on the 1190: 1154: 915:== The placement of the tongue when producing Yish Yash vowel sounds{{subst:anchor|Tongue}} == 638: 136: 284: 935:
then the link from the Proto-Indo-European article would continue to point to the relevant
58: 313: 1253: 836:
The template can be used to create multiple anchors with a single call. For example,
625:
Anchors should never be left unsubstituted within a section header, as this violates
334: 196: 65: 626: 375: 561:
is not in that portion of the markup intended for the classes, styles etc. Thus,
522:. Only use this template in tables if you need multiple anchors for the same row. 430: 399: 406: 344: 143: 100:
Changes to it can cause immediate changes to the Knowledge (XXG) user interface.
420: 368: 95: 244:<span class="anchor" id="Anchor name"></span> 192: 15: 102:
To avoid major disruption, any changes should be tested in the template's
816:<span class="anchor" id="Foo bar"></span> 520:
Help:Tables and locations § Section link or map link to a row anchor
259: 224:
In general, if the intended target of an anchor is a section title, then
206: 866:== The placement of the tongue when producing Yish Yash vowel sounds == 823:
This provides the stable, linkable anchor, but without the edit problem.
651:
Since the anchor is actually used on this documentation page, the links
528:
Anchors may be used within tables, subject to certain restrictions. The
923:== Yish Yash vowel–tongue interaction{{subst:anchor|Tongue}} == 507: 123: 80: 46: 490: 225: 489:
If a template is left unsubstituted inside a section title (
844:
will create three anchors that can then be linked to with
629:
and causes technical complications. More specifically: if
577:(new row), and the following forms of cell are not valid: 1220: 989:
This template prefers inline formatting of parameters.
172:. To link to an anchor from within the same page, use 1096:
To add more than four anchors, go to source editing.
764:== {{anchor|Foo bar}} On foo and its many friends == 761:
would remain valid even if the section were renamed
226:
it should be placed at the end of the section header
815: 569:cannot be placed anywhere on lines that begin with 243: 235:== Section header{{subst:anchor|Anchor name}} == 176:. To link to an anchor from another page, use 161:}} inserts one or more invisible anchor names ( 663:all work and can be tested to see the effect. 605:attribute may be used in each of these areas. 1270:Knowledge (XXG) XHTML tag-replacing templates 8: 976: 768:A drawback of this approach (as detailed in 496:/* Limitations{{anchor|Issues}} */ New issue 969:in articles based on its TemplateData. 545:and the following forms of cell are valid: 1210:Editors can experiment in this template's 982: 269: 518:To see how to set anchors in tables, see 786:) should be different than the section ( 739:within a Knowledge (XXG) article titled 621:Rationale for substitution in the header 92:This template is used in system messages 1265:Pages monitored by Knowledge (XXG) bots 239:which will be saved in the article as: 902:== Yish Yash vowels and the tongue == 474:. However, because some browsers are 182:Help:Link § Section linking (anchors) 135:This template is used by one or more 7: 963:See a monthly parameter usage report 436:, respectively. Markup code such as 250:Anchor names are case sensitive, so 809:which is saved into the article as: 541:|+ {{anchor|FooX}} A table caption 458:Anchor links are case-sensitive in 441: 437: 207:Manual of Style § Section headings 14: 826: 718:(let's call this article "Qux"), 652: 1275:Templates with no visible output 895:is particularly interesting..." 830: 769: 699: 511: 484:=== Efgh{{subst:anchor|bAZ}} === 480:=== Abcd{{subst:anchor|Baz}} === 127: 84: 50: 19: 859:Here is a more literal example: 464:=== Baz{{subst:anchor|Bar}} === 96:approximately 85,000 pages 931:] is particularly interesting. 882:] is particularly interesting. 720:or it could be linked to with 680: 667: 666:For contrast, an anchor named 1: 453:W3C Markup Validation Service 553:You need to ensure that the 660: 617:where the row code starts. 1291: 1184: 953:for this template used by 893:Yish Yash tongue placement 491:which should never be done 1244:Subpages of this template 995: 829:above still applies. See 694:Explanations and examples 163:HTML fragment identifiers 118:before implementing them. 110:subpages, or in your own 803:{{subst:anchor|Foo bar}} 790:) to avoid invalid HTML. 710:could be linked to with 656: 591: 579: 547: 539: 260:Manual of Style: Headers 972:TemplateData for Anchor 716:within the same article 262:for more information). 209:for more information). 1238:Add categories to the 840:{{anchor|Foo|Bar|baz}} 170:{{anchor|Anchor name}} 24:Template documentation 679:Another anchor named 687:{{anchor|Above-Foo}} 675:{{anchor|Under-Foo}} 573:(start of table) or 168:The basic format is 57:This template uses 1260:Lua-based templates 1195:Template:Anchor/doc 1110: 992: 985:Template parameters 983: 981: 831:§ Limitations 770:§ Limitations 749:{{anchor|Foo bar}} 700:§ Limitations 689:== Basic format == 673:== Basic format == 466:, link to it with 184:for more details. 1109: 1108: 1008: 977: 961:and other tools. 940:infrequently are. 782:The anchor name ( 639:MOS:SECTIONANCHOR 526: 525: 412: 411: 242:== Section header 154: 153: 122: 121: 79: 78: 1282: 1235: 1224: 1208: 1180: 1174: 1159: 1153: 1148: 1142: 1137: 1131: 1126: 1120: 1092: 1069: 1046: 1017: 1009: 993: 990: 933: 932: 925: 924: 917: 916: 904: 903: 894: 883: 868: 867: 855: 851: 847: 842: 841: 821: 820: 818: 817: 807: 806: 804: 789: 785: 766: 765: 760: 759: 755:Here, links via 753: 752: 750: 742: 738: 737: 725: 724: 713: 708: 690: 676: 648: 636: 616: 611: 604: 600: 588: 576: 572: 568: 560: 535: 515: 514: 508: 498: 497: 485: 481: 473: 469: 465: 450: 443: 439: 435: 429: 425: 419: 403: 391: 387: 372: 360: 356: 338: 329: 325: 303: 299: 270: 257: 253: 247: 245: 236: 199: 190: 179: 175: 171: 140: 131: 130: 124: 88: 87: 81: 54: 53: 47: 44: 25: 23: 22: 1290: 1289: 1285: 1284: 1283: 1281: 1280: 1279: 1250: 1249: 1248: 1247: 1237: 1229: 1214: 1209: 1198: 1183: 1178: 1172: 1157: 1151: 1146: 1140: 1135: 1129: 1124: 1118: 1115: 1090: 1067: 1044: 1015: 988: 975: 967:Template:Anchor 947: 934: 930: 929: 928: 926: 922: 921: 920: 918: 914: 913: 912: 905: 901: 900: 899: 896: 892: 890: 884: 881: 880: 869: 865: 864: 863: 860: 853: 849: 845: 843: 839: 838: 837: 824: 822: 814: 812: 811: 810: 808: 802: 800: 799: 798: 787: 783: 778: 767: 763: 762: 757: 756: 754: 748: 746: 745: 744: 740: 735: 734: 722: 721: 719: 711: 709: 706: 696: 688: 686: 685: 674: 672: 671: 646: 645: 641:for details). 630: 623: 614: 609: 602: 598: 595: 594: 586: 583: 582: 574: 570: 562: 554: 551: 550: 543: 542: 529: 512: 506: 495: 494: 483: 479: 471: 467: 463: 448: 433: 427: 423: 417: 397: 389: 388: 385: 366: 358: 357: 354: 332: 327: 326: 323: 301: 300: 297: 268: 255: 251: 241: 240: 234: 233: 217: 197: 188: 177: 173: 169: 157:The template {{ 156: 141: 134: 128: 101: 99: 85: 75: 51: 45: 26: 20: 18: 12: 11: 5: 1288: 1286: 1278: 1277: 1272: 1267: 1262: 1252: 1251: 1182: 1181: 1170: 1165: 1160: 1149: 1144:Anchor comment 1138: 1127: 1122:Visible anchor 1114: 1111: 1107: 1106: 1103: 1100: 1099: 1093: 1088: 1084: 1083: 1080: 1077: 1076: 1073:Name of anchor 1070: 1065: 1061: 1060: 1057: 1054: 1053: 1050:Name of anchor 1047: 1042: 1038: 1037: 1034: 1031: 1030: 1029: 1026: 1021:Name of anchor 1018: 1013: 1007: 1006: 1003: 1000: 997: 955:TemplateWizard 948: 946: 943: 942: 941: 857: 834: 791: 781: 731: 707:{{anchor|Foo}} 695: 692: 622: 619: 592: 580: 548: 540: 524: 523: 516: 505: 502: 501: 500: 487: 456: 445: 410: 409: 404: 395: 392: 383: 379: 378: 373: 364: 361: 352: 348: 347: 342: 339: 330: 321: 317: 316: 314:quotation mark 312:(double)  310: 307: 304: 295: 291: 290: 287: 282: 279: 274: 267: 264: 216: 213: 191:, used by the 152: 151: 132: 120: 119: 89: 77: 76: 74: 73: 62: 55: 17: 16: 13: 10: 9: 6: 4: 3: 2: 1287: 1276: 1273: 1271: 1268: 1266: 1263: 1261: 1258: 1257: 1255: 1245: 1241: 1233: 1228: 1222: 1218: 1213: 1206: 1202: 1196: 1192: 1188: 1187:documentation 1177: 1171: 1169: 1166: 1164: 1161: 1156: 1150: 1145: 1139: 1134: 1133:Anchored list 1128: 1123: 1117: 1116: 1112: 1104: 1101: 1098: 1097: 1094: 1089: 1087:Fourth anchor 1086: 1085: 1081: 1078: 1075: 1074: 1071: 1066: 1063: 1062: 1058: 1055: 1052: 1051: 1048: 1043: 1041:Second anchor 1040: 1039: 1035: 1032: 1028:Anchor name 1 1027: 1024: 1023: 1022: 1019: 1014: 1011: 1010: 1004: 1001: 998: 994: 991: 986: 980: 974: 973: 968: 964: 960: 956: 952: 944: 938: 919:or like this: 910: 888: 885:That is some 878: 874: 858: 835: 832: 828: 796: 792: 779: 776: 771: 732: 729: 717: 705: 704: 703: 701: 693: 691: 682: 677: 669: 664: 662: 658: 654: 653:#Basic format 649: 642: 640: 634: 628: 620: 618: 606: 590: 578: 566: 558: 546: 538: 533: 521: 517: 510: 509: 504:Use in tables 503: 492: 488: 477: 461: 457: 454: 446: 432: 422: 414: 413: 408: 405: 401: 396: 393: 384: 381: 380: 377: 374: 370: 365: 362: 359:&vertbar; 353: 350: 349: 346: 343: 340: 336: 331: 322: 319: 318: 315: 311: 308: 305: 296: 293: 292: 288: 286: 283: 280: 278: 275: 272: 271: 265: 263: 261: 248: 237: 231: 227: 222: 219: 214: 212: 210: 208: 202: 200: 194: 185: 183: 166: 165:) in a page. 164: 160: 149: 145: 138: 133: 126: 125: 117: 113: 109: 105: 97: 93: 90: 83: 82: 71: 67: 66:Module:Anchor 64: 63: 60: 56: 49: 48: 42: 38: 34: 30: 1179:}} 1176:Section link 1173:{{ 1158:}} 1152:{{ 1147:}} 1141:{{ 1136:}} 1130:{{ 1125:}} 1119:{{ 1095: 1072: 1064:Third anchor 1049: 1020: 1012:First anchor 987: 984: 978: 971: 970: 966: 959:VisualEditor 951:TemplateData 949:This is the 945:TemplateData 936: 908: 886: 876: 872: 833:for details. 795:substitution 774: 727: 715: 697: 678: 665: 650: 643: 635:}} 632: 631:{{ 627:MOS:HEADINGS 624: 607: 596: 584: 567:}} 564: 563:{{ 559:}} 556: 555:{{ 552: 544: 534:}} 531: 530:{{ 527: 475: 459: 434:}} 428:{{ 424:}} 418:{{ 402:}} 398:{{ 390:&equals; 371:}} 367:{{ 337:}} 333:{{ 249: 238: 230:substitution 223: 220: 218: 215:Basic format 211: 203: 189:#Anchor name 186: 167: 158: 155: 112:user subpage 91: 1191:transcluded 999:Description 751: Foo == 442:<sub> 438:<sup> 266:Limitations 144:User:Cewbot 39:] [ 35:] [ 31:] [ 1254:Categories 1185:The above 813:== Foo 801:== Foo 797:like this: 681:#Above-Foo 668:#Under-Foo 610:{{anchor}} 355:&#124; 298:&quot; 285:Magic word 273:Character 187:Note that 108:/testcases 1242:subpage. 1227:testcases 1168:WP:TARGET 1163:WP:ANCHOR 996:Parameter 736:== Foo == 702:section: 449:#location 386:&#61; 328:&num; 324:&#35; 302:&#34; 281:Template 198:#redirect 193:MediaWiki 116:talk page 94:, and on 1155:Shortcut 1113:See also 1105:optional 1082:optional 1059:optional 1036:required 613:placing 289:Meaning 104:/sandbox 1219:| 1212:sandbox 1205:history 1203:| 1025:Example 937:section 875:within 873:section 819: == 805: == 784:Foo bar 747:== 661:#In-Foo 351:| 70:sandbox 37:history 1236:pages. 1102:String 1079:String 1056:String 1033:String 1005:Status 909:anchor 887:really 775:before 633:anchor 565:anchor 557:anchor 532:anchor 470:, not 407:equals 382:= 180:. See 159:anchor 1193:from 898:this: 780:Note: 728:other 726:from 714:from 43:] 41:purge 27:[ 1240:/doc 1232:edit 1225:and 1221:diff 1217:edit 1201:edit 1002:Type 965:for 891:"... 877:your 852:and 827:Note 825:The 659:and 657:#Foo 597:The 482:and 460:some 440:and 426:and 376:pipe 345:hash 335:hash 277:Code 254:and 148:BRFA 137:bots 33:edit 29:view 1189:is 788:Foo 741:Qux 615:id= 608:If 603:id= 599:id= 587:id= 476:not 228:by 106:or 59:Lua 1256:: 1197:. 957:, 848:, 743:: 655:, 575:|- 571:{| 394:— 363:— 341:— 320:# 309:— 306:— 294:" 246:== 232:: 201:. 150:). 61:: 1246:. 1234:) 1230:( 1223:) 1215:( 1207:) 1199:( 1091:4 1068:3 1045:2 1016:1 856:. 854:] 850:] 846:] 758:] 723:] 712:] 486:. 472:] 468:] 455:. 431:= 421:! 400:= 369:! 256:] 252:] 178:] 174:] 146:( 139:. 98:. 72:) 68:(

Index

view
edit
history
purge
Lua
Module:Anchor
sandbox
approximately 85,000 pages
/sandbox
/testcases
user subpage
talk page
bots
User:Cewbot
BRFA
anchor
HTML fragment identifiers
Help:Link § Section linking (anchors)
MediaWiki
#redirect
Manual of Style § Section headings
it should be placed at the end of the section header
substitution
Manual of Style: Headers
Code
Magic word
quotation mark
hash
hash
!

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

↑