Template:IsDesktop/doc
- Template copied from Genshin Impact Wiki
Note: This template must have the template type "Notice" in order to work properly.
This template allows showing different content for mobile skin and for desktop skin - not just selectively hiding content, but actually having different Wikitext. (See also #Technical explanation)
Syntax
[edit source]{{#if:{{IsDesktop}}
| Content for desktop
| Content for mobile
}}
Examples
[edit source]{{#if:{{IsDesktop}}
| You are now on desktop view. [{{fullurl:{{FULLPAGENAME}}|useskin=fandommobile}} <span class="wds-button">Switch to mobile view</span>]
| You are now on mobile view. [{{fullurl:{{FULLPAGENAME}}|useskin=oasis}} <span class="wds-button">Switch to desktop view</span>]
}}
<div class="mw-collapsible {{#if:{{IsDesktop}}||mw-collapsed}}">
Collapsed by default only on mobile
</div>
Collapsed by default only on mobile
(On mobile, the collapsible above is collapsed by default,
and an "Expand" button should appear here on the right -->
while on desktop it is expanded by default)
Technical explanation
[edit source]Certain template types behave differently on the mobile view (see Help:Template types on Community Central). The template type "Notice", which is intended for editor and maintenance notes, is totally stripped out on the mobile skin since it is mainly aimed for readers.
By combining this behavior with the #if parser function, we can make the parser to render different Wikitext for desktop and for mobile.