Template:ReturnToParent: Difference between revisions

No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 6: Line 6:
: <code><nowiki>{{Return to parent}}</nowiki></code>
: <code><nowiki>{{Return to parent}}</nowiki></code>
: Automatically detects the parent page from the current page name.
: Automatically detects the parent page from the current page name.
: Example: On "Help/Subpage" it displays "Return to Help"
: Example: On "Paige Hyland/Gallery" it displays "Return to Paige Hyland"


; Specify custom parent page
; Specify custom parent page
Line 23: Line 23:


[[Category:Navigation templates]]
[[Category:Navigation templates]]
</noinclude><includeonly>{{#if:{{{parent|}}}|<!--
</noinclude><includeonly>{{#if:{{{parent|}}}
  -->{{#if:{{{text|}}}|<!--
|{{#if:{{{text|}}}
    -->[[{{{parent}}}|{{{text}}}]]|<!--
|[[{{{parent}}}|{{{text}}}]]
    -->[[{{{parent}}}|← Return to {{{parent}}}]]}}|<!--
|[[{{{parent}}}|← Return to {{{parent}}}]]
  -->{{#if:{{{1|}}}|<!--
}}
    -->[[{{{1}}}|← Return to {{{1}}}]]|<!--
|{{#if:{{{1|}}}
    -->{{#ifeq:{{NAMESPACE}}||<!--
|[[{{{1}}}|← Return to {{{1}}}]]
      -->{{#ifexpr:{{PAGESIZE:{{BASEPAGENAME}}}} > 0|<!--
|{{#if:{{#invoke:ParentPage|getParent}}
        -->[[{{BASEPAGENAME}}|← Return to {{BASEPAGENAME}}]]|<!--
|[[{{#invoke:ParentPage|getParent}}|← Return to {{#invoke:ParentPage|getParentName}}]]
        --><span class="error">No parent page found</span>}}|<!--
|<span class="error">This is not a subpage</span>
      -->{{#ifexpr:{{PAGESIZE:{{NAMESPACE}}:{{BASEPAGENAME}}}} > 0|<!--
}}
        -->[[{{NAMESPACE}}:{{BASEPAGENAME}}|← Return to {{BASEPAGENAME}}]]|<!--
}}
        --><span class="error">No parent page found</span>}}}}}}}}</includeonly>
}}</includeonly>