Difference between revisions of "Template:Breadcrumb"
From Chinese Food Wiki
([CFWK] Create template: breadcrumb (uses Module:Breadcrumb)) |
([CFWK] Breadcrumb: plain-wikitext version (Scribunto/Lua cannot run on this server)) |
||
| Line 1: | Line 1: | ||
{{# | <div class="cfwk-breadcrumb small text-muted mb-2" role="navigation" aria-label="Breadcrumb">{{#ifeq:{{{parent|{{{1|}}}}}}|{{{root|Chinese Food Map}}}||{{#ifeq:{{{parent2|}}}|{{{root|Chinese Food Map}}}||[[{{{root|Chinese Food Map}}}]]<span class="cfwk-bc-sep" aria-hidden="true"> › </span>}}}}{{#if:{{{parent2|}}}|[[{{{parent2}}}]]<span class="cfwk-bc-sep" aria-hidden="true"> › </span>}}{{#if:{{{parent|{{{1|}}}}}}|[[{{{parent|{{{1|}}}}}}]]<span class="cfwk-bc-sep" aria-hidden="true"> › </span>}}<span class="cfwk-bc-current" aria-current="page">{{{label|{{PAGENAME}}}}}</span></div><noinclude> | ||
== Documentation == | == Documentation == | ||
Shows a breadcrumb trail at the top of a page, for example ''Chinese Food Map › Sichuan Food › Sichuan Cuisine''. | Shows a breadcrumb trail at the top of a page, for example ''Chinese Food Map › Sichuan Food › Sichuan Cuisine''. This is a plain-wikitext template. A Lua version was planned, but Scribunto cannot run Lua on this server yet: saving [[Module:Breadcrumb]] fails with a "cannot create process" error. If Lua is enabled later, the trail could be built automatically from each parent page. | ||
=== Usage === | === Usage === | ||
| Line 7: | Line 7: | ||
{{Breadcrumb|parent=Sichuan Food}} | {{Breadcrumb|parent=Sichuan Food}} | ||
</pre> | </pre> | ||
* <code>parent</code> (or the first unnamed parameter): the page directly above this one, for example the province hub for a dish | * <code>parent</code> (or the first unnamed parameter): the page directly above this one, for example the province hub for a dish page. | ||
* <code>label</code> (optional): text for the current page | * <code>parent2</code> (optional): the level above <code>parent</code>. Use it for a third level, for example a dish page under a city hub: <code><nowiki>{{Breadcrumb|parent=Chengdu Food|parent2=Sichuan Food}}</nowiki></code> gives ''Chinese Food Map › Sichuan Food › Chengdu Food › (page)''. | ||
* <code>root</code> (optional): top of the trail | * <code>label</code> (optional): text for the current page. The default is the page name. | ||
* <code>root</code> (optional): the top of the trail. The default is ''Chinese Food Map''. The root is always shown first, and it is not repeated when <code>parent</code> or <code>parent2</code> is the root itself. | |||
Examples: | |||
* Sichuan Food: <code><nowiki>{{Breadcrumb|parent=Chinese Food Map}}</nowiki></code> → Chinese Food Map › Sichuan Food | * Sichuan Food: <code><nowiki>{{Breadcrumb|parent=Chinese Food Map}}</nowiki></code> → Chinese Food Map › Sichuan Food | ||
* Sichuan Cuisine: <code><nowiki>{{Breadcrumb|parent=Sichuan Food}}</nowiki></code> → Chinese Food Map › Sichuan Food › Sichuan Cuisine | * Sichuan Cuisine: <code><nowiki>{{Breadcrumb|parent=Sichuan Food}}</nowiki></code> → Chinese Food Map › Sichuan Food › Sichuan Cuisine | ||
Latest revision as of 16:43, 25 September 2026
Documentation
Shows a breadcrumb trail at the top of a page, for example Chinese Food Map › Sichuan Food › Sichuan Cuisine. This is a plain-wikitext template. A Lua version was planned, but Scribunto cannot run Lua on this server yet: saving Module:Breadcrumb fails with a "cannot create process" error. If Lua is enabled later, the trail could be built automatically from each parent page.
Usage
{{Breadcrumb|parent=Sichuan Food}}
parent(or the first unnamed parameter): the page directly above this one, for example the province hub for a dish page.parent2(optional): the level aboveparent. Use it for a third level, for example a dish page under a city hub:{{Breadcrumb|parent=Chengdu Food|parent2=Sichuan Food}}gives Chinese Food Map › Sichuan Food › Chengdu Food › (page).label(optional): text for the current page. The default is the page name.root(optional): the top of the trail. The default is Chinese Food Map. The root is always shown first, and it is not repeated whenparentorparent2is the root itself.
Examples:
- Sichuan Food:
{{Breadcrumb|parent=Chinese Food Map}}→ Chinese Food Map › Sichuan Food - Sichuan Cuisine:
{{Breadcrumb|parent=Sichuan Food}}→ Chinese Food Map › Sichuan Food › Sichuan Cuisine
Place it at the very top of the article text, after the SEO block and before the infobox. Hook classes: cfwk-breadcrumb, cfwk-bc-sep, cfwk-bc-current.