Template:EmbeddedSubpageLink: Difference between revisions
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>[[{{{1}}}{{#switch:{{SUBPAGENAME}}|{{{2}}}=/|#}}{{{2}}}|{{{2}}}]]</includeonly><noinclude> | <includeonly>[[{{{1}}}{{#switch:{{SUBPAGENAME}}|{{{2}}}=/|#}}{{{2}}}|{{{3|{{{2}}}}}}]]</includeonly><noinclude> | ||
Link to [[Patterns#Embedded Subpages]] nicely for Navboxes and other cases where showing if it is a link to the current page is important. | Link to [[Editing_Guide/Patterns#embedded subpages|Embedded Subpages]] nicely for Navboxes and other cases where showing if it is a link to the current page is important. | ||
Example: | Example: | ||
{{EmbeddedSubpageLink| | <pre><nowiki>{{EmbeddedSubpageLink|Outer Wilds|Echoes of the Eye}}</nowiki></pre> | ||
{{EmbeddedSubpageLink|Outer Wilds|Echoes of the Eye}} | |||
See how this becomes a self-link when viewed on [[Outer Wilds/Echoes of the Eye]] in the navbox. | |||
<templatedata> | <templatedata> | ||
Line 19: | Line 21: | ||
"type": "string", | "type": "string", | ||
"required": true | "required": true | ||
}, | |||
"3": { | |||
"label": "Title", | |||
"description": "Used to override the text of the link, by default this will be the subpage name.", | |||
"type": "string" | |||
} | } | ||
}, | }, |
Latest revision as of 17:51, 25 January 2025
Link to Embedded Subpages nicely for Navboxes and other cases where showing if it is a link to the current page is important.
Example:
{{EmbeddedSubpageLink|Outer Wilds|Echoes of the Eye}}
Echoes of the Eye See how this becomes a self-link when viewed on Outer Wilds/Echoes of the Eye in the navbox.
Links to an embedded subpage, most of the time this will link to the section of the parent article page for the subpage, but if you are on the subpage, it'll link to the subpage, this makes it treat it as the current page, which is nicer in navboxes and the like.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Parent Page | 1 | The name of the parent page. | Page name | required |
Subpage/Section Name | 2 | The name of the subpage (without the parent/ prefix). This must be the name of a section including the subpage into the parent page too. | String | required |
Title | 3 | Used to override the text of the link, by default this will be the subpage name. | String | optional |