Template:ReturnToParent: Difference between revisions

No edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div style="margin: 10px 0; padding: 10px; border: 1px solid #ccc; background-color: #f9f9f9; border-radius: 5px;">
<noinclude>
  <span style="font-size: 14px; font-weight: bold;">
This template creates a link to return to the parent page.
    ⬅ [[{{{1|..}}}|Return to Parent Page]]
 
  </span>
== Usage ==
</div>
; Automatic parent detection
: <code><nowiki>{{Return to parent}}</nowiki></code>
: Automatically detects the parent page from the current page name.
: Example: On "Paige Hyland/Gallery" it displays "Return to Paige Hyland"
 
; Specify custom parent page
: <code><nowiki>{{Return to parent|CustomPage}}</nowiki></code>
: Links to the specified page instead.
: Example: <code><nowiki>{{Return to parent|Main Page}}</nowiki></code>
 
; Custom link text
: <code><nowiki>{{Return to parent|parent=Help|text=Back to Help}}</nowiki></code>
: Allows customizing both the parent page and the link text.
 
== Examples ==
* <code><nowiki>{{Return to parent}}</nowiki></code>
* <code><nowiki>{{Return to parent|Help}}</nowiki></code>
* <code><nowiki>{{Return to parent|parent=Portal:Contents|text=← Back to Contents}}</nowiki></code>
 
[[Category:Navigation templates]]
</noinclude><includeonly>{{#if:{{{parent|}}}
|{{#if:{{{text|}}}
|[[{{{parent}}}|{{{text}}}]]
|[[{{{parent}}}|← Return to {{{parent}}}]]
}}
|{{#if:{{{1|}}}
|[[{{{1}}}|← Return to {{{1}}}]]
|{{#if:{{#invoke:ParentPage|getParent}}
|[[{{#invoke:ParentPage|getParent}}|Return to {{#invoke:ParentPage|getParentName}}]]
|<span class="error">This is not a subpage</span>
}}
}}
}}</includeonly>