Revizyonları karşılaştır

How to use "For" tags

Revizyon 280477:

Revizyon 280477, moz_contrib tarafından tarihinde

Revizyon 284255:

Revizyon 284255, erling.rosag tarafından tarihinde

Anahtar sözcükler:

Arama sonuçları özeti:

Learn how to use “for” markup in Mozilla Support articles, to show content for different operating systems and product versions
Learn how to use “for” markup in Mozilla Support articles, to show content for different operating systems and product versions

İçerik:

One of the great features of our Knowledge Base is the ability to show instructions customized for operating systems (Windows, Mac, etc.) and Firefox versions. We can say, for example, that a certain section of a help article is “for” Windows users and Mac and Linux users won't see it. The feature is designed to work invisibly. When someone opens a help article, we'll automatically detect what operating system and version of Firefox they are using and show the appropriate instructions. This article goes over the details of how to use <nowiki>{</nowiki>for<nowiki>}</nowiki> in Knowledge Base articles. {warning}'''Localizers:''' when localizing articles with <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> elements in the content, do not translate anything inside the { and } brackets! Keep them the same way they look in the original text. This is important to have the element function properly.{/warning} __TOC__ = How to switch instructions to different operating systems or Firefox versions = In order to follow the example in this article, you'll have to switch the article selector to different operating systems and Firefox versions. It's located in the right panel of the article, under ''Editing Tools''. ;[[Image:CustomizeThisArticle-2023]] = Basic syntax and behavior = ==Operating systems== Here is the syntax to show an image for '''Windows 10''': ;'''<code><nowiki>{</nowiki>for win10<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows 10 to see the image: *;{for win10}[[Image:Windows Logo]]{/for} {for win10} *If you change the selector to Windows XP, Windows 7, Windows 8, Windows 11, Mac or Linux, the image above won't be shown because it's not “for” them. {/for} Although the Windows selector doesn't exist, you can write instructions that apply to all Windows versions: ;'''<code><nowiki>{</nowiki>for win<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Image:vista.jpg]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows XP, Windows 7/Vista, Windows 8, Windows 10, or Windows 11 to see the image: *;{for win}[[Image:vista.jpg]]{/for} {for win} *If you change the selector to Mac or Linux, the image above won't be shown because it's not “for” them. {/for} ==Firefox versions== Here is the syntax to show something for '''Firefox 115 and above''': ;'''<code><nowiki>{</nowiki>for fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Firefox 115 or higher to see the image: *;{for fx115}[[Image:Firefox Quantum Logo]]{/for} {for fx114} *If you change the selector to Firefox 114 or lower, the message above will disappear because it's not “for” those versions. {/for} ===Show instructions for only one version of Firefox=== To show instructions '''only for Firefox 115''', use the “=” operator: ;'''<code><nowiki>{</nowiki>for =fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Now the image only shows when you change the selector to Firefox 115: *;{for =fx115}[[Image:Firefox Quantum Logo]]{/for} ==Combining operating systems and Firefox versions== You can specify an operating system and a Firefox version by separating them with a comma: ;'''<code><nowiki>{</nowiki>for win,fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows and Firefox 115 or higher to see images: *;{for win,fx115}[[Image:Windows Logo]][[Image:Firefox Quantum Logo]]{/for} A more complex situation with an implied “for” can be written like this: ;'''<code><nowiki>{</nowiki>for mac, win10, win11, =fx113, fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:macos.jpg]]<nowiki>[[</nowiki>Image:Firefox Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Mac or Windows 10 or Windows 11 and Firefox 113 or Firefox 115 and above to see images: *;{for mac, win10, win11, =fx113, fx115}[[Image:Windows Logo]][[Image:macos.jpg]][[Image:Firefox Quantum Logo]]{/for} ==Negating conditions== You can negate a condition by preceding it with the word <code>not</code>. A negated condition is true if and only if the condition is false. For example, the condition ;'''<code>not fx115</code>''' is true if the Firefox version is less than 115. ==Leverage <nowiki>{for}</nowiki> tags for advanced versioning control== With frequent updates and feature releases in Firefox, ''for'' tags play a key role for targeted content curation, enabling us to deliver relevant information to users based on their specific version of Firefox. Key applications of these tags include: *'''Early access for Nightly and Beta Users:''' It allows us to present upcoming features or changes to users who are on Nightly and Beta channels, giving them a heads-up about what they might find. This ensures that our most engaged and technical users can start exploring new functionalities ahead of the broader community. *'''Localization ahead of launch:''' ''for'' tags allow us to publish content for upcoming versions ahead of their public release. This allows our localization community to prepare translations early, guaranteeing multi-language support the moment a new version goes live in the Production channel. *'''Avoid confusion among general audience:''' Using ''for'' tags, we strategically avoid exposing our general audience to premature information, thereby preventing confusion about what's currently available in their current version of Firefox. ==When the contents are shown== Formally, the markup between <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> will be ''shown'' if both of these conditions are met: * The <nowiki>{</nowiki>for<nowiki>}</nowiki> has no operating system (OS) condition, or it has at least one OS condition that is true regarding the OS the user is running (or has manually selected). * The <nowiki>{</nowiki>for<nowiki>}</nowiki> has no Firefox version condition, or it has at least one Firefox version condition that is true regarding the Firefox version the user is running (or has manually selected). Otherwise, the contents of the <nowiki>{</nowiki>for<nowiki>}</nowiki>…<nowiki>{</nowiki>/for<nowiki>}</nowiki> are not shown. {note}Any content enclosed within a <nowiki>{</nowiki>for<nowiki>}</nowiki> tag, aimed at earlier Firefox versions, remains visible to users of those versions even if those versions aren't listed in the version selector.{/note} A few other things to note: * Spaces after the commas are optional. * <nowiki>{</nowiki>for<nowiki>}</nowiki> and other wiki markup don't work in article search summaries. * Headings which are hidden by <nowiki>{</nowiki>for<nowiki>}</nowiki> blocks do not appear in the page's table of contents. If the user causes them to show by manually selecting the right OS/browser combination, the table of contents entries instantly appear. == Operating system and product abbreviations == These are the operating system and product abbreviations available for use with <nowiki>{</nowiki>for<nowiki>}</nowiki>: * win (Windows) * winxp (Windows XP/2000/Server 2003) * win7 (Windows 7/Vista/Server 2008) * win8 (Windows 8/8.1/Server 2012) * win10 (Windows 10) * win11 (Windows 11) * mac (macOS) * linux (Linux) * fxN where N = the Firefox (desktop) version, for example fx115, fx116, fx117, etc. * mN where N = the Firefox for Android (mobile) version, for example m115, m116, m117, etc. * tbN where N = the Thunderbird version, for example tb91, tb102, tb115, etc. You have to use fxN in Firefox support articles, mN in Firefox for Android support articles and tbN in Thunderbird support articles. == Inline and block-level contexts == <nowiki>{</nowiki>for<nowiki>}</nowiki> can be used in both inline and block-level contexts (in the HTML sense). The inline form takes effect when working within a line of text: '''This is <nowiki>{</nowiki>for win<nowiki>}</nowiki>inline use<nowiki>{</nowiki>/for<nowiki>}</nowiki>.''' The block form is used to wrap entire paragraphs, ordered lists, headings, and so on. The only caveat is that, when using the block form, the <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> should each be on a line by itself. Otherwise, it might be considered part of a neighboring paragraph and produce surprising results. ;'''<nowiki>{</nowiki>for win<nowiki>}</nowiki>''' ;'''This is block-level.''' ;'''<nowiki>*</nowiki>One''' ;'''<nowiki>*</nowiki>Two''' ;'''<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' = Best practices for using <nowiki>{</nowiki>for} in articles = '''When writing instructions for different operating systems, it's best to write complete sentences and paragraphs for each OS/Firefox version, even if it means duplicating things.''' This makes the article easier to understand, maintain and localize. When it comes time, for example, to remove specific instructions for Firefox 115 and below, those sections can just be deleted rather than trying to excise them from a larger section. *The '''wrong way''' to use <nowiki>{</nowiki>for}: *;<nowiki>#</nowiki><nowiki>{</nowiki>for not fx115}<nowiki>{</nowiki>for win,linux}At the top of the Firefox window<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar<nowiki>{</nowiki>/for}, click on the <nowiki>{</nowiki>/for}<nowiki>{</nowiki>for fx115}Click the menu button, go over to the <nowiki>{</nowiki>menu History} menu<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for winxp,mac,linux,not fx115}<nowiki>{</nowiki>menu Tools} menu<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for win7,win8,not fx115}<nowiki>{</nowiki>menu Firefox} menu, go over to the <nowiki>{</nowiki>menu History} menu<nowiki>{</nowiki>/for} and select <nowiki>{</nowiki>menu Clear Recent History…} *The '''right way''' to use <nowiki>{</nowiki>for}: *;<nowiki>{</nowiki>for not fx115} *;<nowiki>#</nowiki><nowiki>{</nowiki>for win7,win8}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Firefox} menu, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History…}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History…}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for winxp,linux}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History…}<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>for fx115} *;<nowiki>#</nowiki>Click the menu button, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History…} *;<nowiki>{</nowiki>/for} *In the following example, we treat Firefox 113 and below, Firefox 114/115, and Firefox 116 and above as three different sets of instructions. That's often the case, but more and more as we change Firefox every four weeks we'll see more changes in later versions. They'll look like this: *;<nowiki>{</nowiki>for not fx114} *;<nowiki>#</nowiki>The old instructions. *;<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>for =fx114,=fx115} *;<nowiki>#</nowiki>The new instructions. *;<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>for fx116} *;<nowiki>#</nowiki>The NEW new instructions. *;<nowiki>{</nowiki>/for} = Complete Knowledge Base guidelines = See [https://support.mozilla.org/en-US/products/contributor/kb more guidelines on Knowledge Base contribution here].
One of the great features of our Knowledge Base is the ability to show instructions customized for operating systems (Windows, Mac, etc.) and Firefox versions. We can say, for example, that a certain section of a help article is “for” Windows users and Mac and Linux users won't see it. The feature is designed to work invisibly. When someone opens a help article, we'll automatically detect what operating system and version of Firefox they are using and show the appropriate instructions. This article goes over the details of how to use <nowiki>{</nowiki>for<nowiki>}</nowiki> in Knowledge Base articles. {warning}'''Localizers:''' when localizing articles with <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> elements in the content, do not translate anything inside the { and } brackets! Keep them the same way they look in the original text. This is important to have the element function properly.{/warning} __TOC__ = How to switch instructions to different operating systems or Firefox versions = In order to follow the example in this article, you'll have to switch the article selector to different operating systems and Firefox versions. It's located in the right panel of the article, under ''Editing Tools''. ;[[Image:CustomizeThisArticle-2023]] = Basic syntax and behavior = ==Operating systems== Here is the syntax to show an image for '''Windows 10''': ;'''<code><nowiki>{</nowiki>for win10<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows 10 to see the image: *;{for win10}[[Image:Windows Logo]]{/for} {for win10} *If you change the selector to Windows XP, Windows 7, Windows 8, Windows 11, Mac or Linux, the image above won't be shown because it's not “for” them. {/for} Although the Windows selector doesn't exist, you can write instructions that apply to all Windows versions: ;'''<code><nowiki>{</nowiki>for win<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Image:vista.jpg]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows XP, Windows 7/Vista, Windows 8, Windows 10, or Windows 11 to see the image: *;{for win}[[Image:vista.jpg]]{/for} {for win} *If you change the selector to Mac or Linux, the image above won't be shown because it's not “for” them. {/for} ==Firefox versions== Here is the syntax to show something for '''Firefox 115 and above''': ;'''<code><nowiki>{</nowiki>for fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Firefox 115 or higher to see the image: *;{for fx115}[[Image:Firefox Quantum Logo]]{/for} {for fx114} *If you change the selector to Firefox 114 or lower, the message above will disappear because it's not “for” those versions. {/for} ===Show instructions for only one version of Firefox=== To show instructions '''only for Firefox 115''', use the “=” operator: ;'''<code><nowiki>{</nowiki>for =fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Firefox Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Now the image only shows when you change the selector to Firefox 115: *;{for =fx115}[[Image:Firefox Quantum Logo]]{/for} ==Combining operating systems and Firefox versions== You can specify an operating system and a Firefox version by separating them with a comma: ;'''<code><nowiki>{</nowiki>for win,fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Windows and Firefox 115 or higher to see images: *;{for win,fx115}[[Image:Windows Logo]][[Image:Firefox Quantum Logo]]{/for} A more complex situation with an implied “for” can be written like this: ;'''<code><nowiki>{</nowiki>for mac, win10, win11, =fx113, fx115<nowiki>}</nowiki><nowiki>[[</nowiki>Image:Windows Logo]]<nowiki>[[</nowiki>Image:macos.jpg]]<nowiki>[[</nowiki>Image:Firefox Quantum Logo]]<nowiki>{</nowiki>/for<nowiki>}</nowiki></code>''' *Change the selector to Mac or Windows 10 or Windows 11 and Firefox 113 or Firefox 115 and above to see images: *;{for mac, win10, win11, =fx113, fx115}[[Image:Windows Logo]][[Image:macos.jpg]][[Image:Firefox Quantum Logo]]{/for} ==Negating conditions== You can negate a condition by preceding it with the word <code>not</code>. A negated condition is true if and only if the condition is false. For example, the condition ;'''<code>not fx115</code>''' is true if the Firefox version is less than 115. ==Leverage <nowiki>{</nowiki>for<nowiki>}</nowiki> tags for advanced versioning control== With frequent updates and feature releases in Firefox, ''for'' tags play a key role for targeted content curation, enabling us to deliver relevant information to users based on their specific version of Firefox. Key applications of these tags include: *'''Early access for Nightly and Beta Users:''' It allows us to present upcoming features or changes to users who are on Nightly and Beta channels, giving them a heads-up about what they might find. This ensures that our most engaged and technical users can start exploring new functionalities ahead of the broader community. *'''Localization ahead of launch:''' ''for'' tags allow us to publish content for upcoming versions ahead of their public release. This allows our localization community to prepare translations early, guaranteeing multi-language support the moment a new version goes live in the Production channel. *'''Avoid confusion among general audience:''' Using ''for'' tags, we strategically avoid exposing our general audience to premature information, thereby preventing confusion about what's currently available in their current version of Firefox. ==When the contents are shown== Formally, the markup between <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> will be ''shown'' if both of these conditions are met: * The <nowiki>{</nowiki>for<nowiki>}</nowiki> has no operating system (OS) condition, or it has at least one OS condition that is true regarding the OS the user is running (or has manually selected). * The <nowiki>{</nowiki>for<nowiki>}</nowiki> has no Firefox version condition, or it has at least one Firefox version condition that is true regarding the Firefox version the user is running (or has manually selected). Otherwise, the contents of the <nowiki>{</nowiki>for<nowiki>}</nowiki>…<nowiki>{</nowiki>/for<nowiki>}</nowiki> are not shown. {note}Any content enclosed within a <nowiki>{</nowiki>for<nowiki>}</nowiki> tag, aimed at earlier Firefox versions, remains visible to users of those versions even if those versions aren't listed in the version selector.{/note} A few other things to note: * Spaces after the commas are optional. * <nowiki>{</nowiki>for<nowiki>}</nowiki> and other wiki markup don't work in article search summaries. * Headings which are hidden by <nowiki>{</nowiki>for<nowiki>}</nowiki> blocks do not appear in the page's table of contents. If the user causes them to show by manually selecting the right OS/browser combination, the table of contents entries instantly appear. == Operating system and product abbreviations == These are the operating system and product abbreviations available for use with <nowiki>{</nowiki>for<nowiki>}</nowiki>: * win (Windows) * winxp (Windows XP/2000/Server 2003) * win7 (Windows 7/Vista/Server 2008) * win8 (Windows 8/8.1/Server 2012) * win10 (Windows 10) * win11 (Windows 11) * mac (macOS) * linux (Linux) * fxN where N = the Firefox (desktop) version, for example fx115, fx116, fx117, etc. * mN where N = the Firefox for Android (mobile) version, for example m115, m116, m117, etc. * tbN where N = the Thunderbird version, for example tb91, tb102, tb115, etc. You have to use fxN in Firefox support articles, mN in Firefox for Android support articles and tbN in Thunderbird support articles. == Inline and block-level contexts == <nowiki>{</nowiki>for<nowiki>}</nowiki> can be used in both inline and block-level contexts (in the HTML sense). The inline form takes effect when working within a line of text: '''This is <nowiki>{</nowiki>for win<nowiki>}</nowiki>inline use<nowiki>{</nowiki>/for<nowiki>}</nowiki>.''' The block form is used to wrap entire paragraphs, ordered lists, headings, and so on. The only caveat is that, when using the block form, the <nowiki>{</nowiki>for<nowiki>}</nowiki> and <nowiki>{</nowiki>/for<nowiki>}</nowiki> should each be on a line by itself. Otherwise, it might be considered part of a neighboring paragraph and produce surprising results. ;'''<nowiki>{</nowiki>for win<nowiki>}</nowiki>''' ;'''This is block-level.''' ;'''<nowiki>*</nowiki>One''' ;'''<nowiki>*</nowiki>Two''' ;'''<nowiki>{</nowiki>/for<nowiki>}</nowiki>''' = Best practices for using <nowiki>{</nowiki>for} in articles = '''When writing instructions for different operating systems, it's best to write complete sentences and paragraphs for each OS/Firefox version, even if it means duplicating things.''' This makes the article easier to understand, maintain and localize. When it comes time, for example, to remove specific instructions for Firefox 115 and below, those sections can just be deleted rather than trying to excise them from a larger section. *The '''wrong way''' to use <nowiki>{</nowiki>for}: *;<nowiki>#</nowiki><nowiki>{</nowiki>for not fx115}<nowiki>{</nowiki>for win,linux}At the top of the Firefox window<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar<nowiki>{</nowiki>/for}, click on the <nowiki>{</nowiki>/for}<nowiki>{</nowiki>for fx115}Click the menu button, go over to the <nowiki>{</nowiki>menu History} menu<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for winxp,mac,linux,not fx115}<nowiki>{</nowiki>menu Tools} menu<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for win7,win8,not fx115}<nowiki>{</nowiki>menu Firefox} menu, go over to the <nowiki>{</nowiki>menu History} menu<nowiki>{</nowiki>/for} and select <nowiki>{</nowiki>menu Clear Recent History…} *The '''right way''' to use <nowiki>{</nowiki>for}: *;<nowiki>{</nowiki>for not fx115} *;<nowiki>#</nowiki><nowiki>{</nowiki>for win7,win8}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Firefox} menu, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History…}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for mac}On the menu bar, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History…}<nowiki>{</nowiki>/for}<nowiki>{</nowiki>for winxp,linux}At the top of the Firefox window, click on the <nowiki>{menu</nowiki> Tools} menu and select <nowiki>{menu</nowiki> Clear Recent History…}<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>for fx115} *;<nowiki>#</nowiki>Click the menu button, go over to the <nowiki>{menu</nowiki> History} menu and select <nowiki>{menu</nowiki> Clear Recent History…} *;<nowiki>{</nowiki>/for} *In the following example, we treat Firefox 113 and below, Firefox 114/115, and Firefox 116 and above as three different sets of instructions. That's often the case, but more and more as we change Firefox every four weeks we'll see more changes in later versions. They'll look like this: *;<nowiki>{</nowiki>for not fx114} *;<nowiki>#</nowiki>The old instructions. *;<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>for =fx114,=fx115} *;<nowiki>#</nowiki>The new instructions. *;<nowiki>{</nowiki>/for} *;<nowiki>{</nowiki>for fx116} *;<nowiki>#</nowiki>The NEW new instructions. *;<nowiki>{</nowiki>/for} = Complete Knowledge Base guidelines = See [https://support.mozilla.org/en-US/products/contributor/kb more guidelines on Knowledge Base contribution here].

Geçmişe dön