Skip to content

Commit 0072410

Browse files
authored
Add GitHub AE syntax and additional GitHub Enterprise Server syntax to internal documentation on Liquid helpers (github#18190)
1 parent 7e7268e commit 0072410

File tree

1 file changed

+123
-38
lines changed

1 file changed

+123
-38
lines changed

contributing/liquid-helpers.md

Lines changed: 123 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,62 @@
11
# Liquid helpers <!-- omit in toc -->
22

3-
We use the [liquid template language](https://shopify.github.io/liquid/basics/introduction/) (specifically, [this Node.js port](https://github.com/docs/liquid)) to create different versions of our content.
3+
We use the [Liquid template language](https://shopify.github.io/liquid/basics/introduction/) (specifically, [this Node.js port](https://github.com/docs/liquid)) to create different versions of our content.
44

55
Note: If you are an open source contributor, you should not worry about versioning content. This document is only here as reference.
66

7-
## Versioning documentation for GitHub Enterprise <!-- omit in toc -->
7+
## Versioning documentation for GitHub.com, GitHub Enterprise Server, and GitHub AE<!-- omit in toc -->
88

99
**In this guide**
10-
- [Versioned documentation types for GitHub Enterprise](#versioned-documentation-types-for-github-enterprise)
10+
- [Versioned documentation](#versioned-documentation)
11+
- [Dotcom](#dotcom)
12+
- [GitHub Enterprise Server](#github-enterprise-server)
13+
- [GitHub AE](#github-ae)
14+
- [Versioning in the YAML front matter](#versioning-in-the-yaml-front-matter)
1115
- [Liquid conditional operators](#liquid-conditional-operators)
1216
- [Comparison operators](#comparison-operators)
1317
- [Logical operators](#logical-operators)
14-
- [Liquid conditional statements for GitHub Enterprise](#liquid-conditional-statements-for-github-enterprise)
15-
- [Including content in *all* supported versions](#including-content-in-all-supported-versions)
18+
- [Liquid conditional statements for Dotcom](#liquid-conditional-statements-for-dotcom)
1619
- [Including content that *only applies to Dotcom*](#including-content-that-only-applies-to-dotcom)
17-
- [Including content for *new Dotcom features* that will be included in Enterprise](#including-content-for-new-dotcom-features-that-will-be-included-in-enterprise)
18-
- [Including content for *changed* Dotcom features that will also change in Enterprise](#including-content-for-changed-dotcom-features-that-will-also-change-in-enterprise)
19-
- [Including content for *changed* Dotcom features that will also change in Enterprise but don't exist in some older versions](#including-content-for-changed-dotcom-features-that-will-also-change-in-enterprise-but-dont-exist-in-some-older-versions)
20-
- [Including content for *new Enterprise features* that don't exist on Dotcom](#including-content-for-new-enterprise-features-that-dont-exist-on-dotcom)
21-
- [Including content for *changed Enterprise features* that don't exist on Dotcom](#including-content-for-changed-enterprise-features-that-dont-exist-on-dotcom)
20+
- [Liquid conditional statements for GitHub Enterprise Server](#liquid-conditional-statements-for-github-enterprise-server)
21+
- [Including content that only applies to all supported versions of Enterprise Server](#including-content-that-only-applies-to-all-supported-versions-of-enterprise-server)
22+
- [Including content for *new Dotcom features* that will be included in Enterprise Server](#including-content-for-new-dotcom-features-that-will-be-included-in-enterprise-server)
23+
- [Including content for *changed* Dotcom features that will also change in Enterprise Server](#including-content-for-changed-dotcom-features-that-will-also-change-in-enterprise-server)
24+
- [Including content for *changed* Dotcom features that will also change in Enterprise Server but don't exist in some older versions](#including-content-for-changed-dotcom-features-that-will-also-change-in-enterprise-server-but-dont-exist-in-some-older-versions)
25+
- [Including content for *new Enterprise Server features* that don't exist on Dotcom](#including-content-for-new-enterprise-server-features-that-dont-exist-on-dotcom)
26+
- [Including content for *changed Enterprise Server features* that don't exist on Dotcom](#including-content-for-changed-enterprise-server-features-that-dont-exist-on-dotcom)
27+
- [Liquid conditional statements for GitHub AE](#liquid-conditional-statements-for-github-ae)
28+
- [Including content that *only applies to GitHub AE*](#including-content-that-only-applies-to-github-ae)
29+
- [Including content that only applies to *GitHub AE and Enterprise Server*](#including-content-that-only-applies-to-github-ae-and-github-enterprise-server)
30+
- [Including content for features that will be included in the *next release* of GitHub AE](#including-content-for-features-that-will-be-included-in-the-next-release-of-github-ae)
2231

23-
### Versioned documentation types for GitHub Enterprise
32+
### Versioned documentation
2433

25-
We provide versioned documentation for GitHub Enterprise users. This means the material on docs.github.com is scoped to specific product offerings.
34+
We provide versioned documentation for users of GitHub.com (Dotcom), GitHub Enterprise Server, and GitHub AE. This means the material on docs.github.com is scoped to specific product offerings. If multiple versions of content exist, readers can choose the version from the version picker at the top of the page.
2635

27-
Documentation for GitHub Enterprise can generally be divided into three types: documentation for the latest release, documentation for any previous supported release, and documentation for a deprecated release.
36+
#### Dotcom
2837

38+
Documentation for Dotcom has one version: the latest version.
39+
40+
#### GitHub Enterprise Server
41+
42+
Documentation for GitHub Enterprise Server can generally be divided into three types: documentation for the latest release, documentation for any previous supported release, and documentation for a deprecated release.
43+
44+
#### GitHub AE
45+
46+
Documentation for GitHub AE is similar to Dotcom: we only offer one version of the content for the product, the latest version.
47+
48+
### Versioning in the YAML front matter
49+
50+
Use the `versions` key within the file's YAML front matter to define which products an entire page applies to. For more information, see [the _content_ directory's README](/content#versions).
51+
52+
By default, any text in the body of the Markdown file will display for all product versions that you define in the `versions` key.
2953

3054
### Liquid conditional operators
3155

56+
If you define multiple products in the `versions` key within a page's YAML front matter, you can use the conditional operators `if`/`else` and `if`/`elsif`/`else` in the page's body to control how the site renders content on the page for a particular product. For example, a feature may have more options on Dotcom than on GitHub Enterprise Server, so you can version the content for both Dotcom and GitHub Enterprise Server via the `versions` front matter, then use Liquid conditionals to describe the additional options for Dotcom within the rendered HTML.
57+
58+
Use the operators in Liquid tags (`{% ... %}`). Do not use `else if`. If you do, the content in that portion of the block will not render.
59+
3260
#### Comparison operators
3361

3462
|Operator | Meaning|
@@ -56,34 +84,48 @@ In statements where **at least one** operand must be true for the condition to b
5684

5785
Do **not** use the operators `&&` or `||`. If you do, the content will not render in the intended versions. Only use `and` or `or`.
5886

59-
### Liquid conditional statements for GitHub Enterprise
87+
### Liquid conditional statements for Dotcom
88+
89+
If the Markdown source's `versions` front matter includes Dotcom and you want the content to display for Dotcom, do not include any Liquid logic at all. Deploying the site will automatically generate the HTML content for Dotcom.
90+
91+
#### Including content that *only applies to Dotcom*
92+
93+
If your content only applies to GitHub.com, such as billing information, use this logic:
94+
95+
```
96+
{% if currentVersion == "free-pro-team@latest" %}This is how you pay for your personal account, which is something you wouldn't do in Enterprise.{% endif %}
97+
```
98+
99+
In this example:
100+
- `if currentVersion == "free-pro-team@latest"` will include the content for Dotcom output and *only* Dotcom.
101+
- `{% endif %}` ends the statement.
102+
103+
### Liquid conditional statements for GitHub Enterprise Server
60104

61-
Use the custom `ver_gt` and `ver_lt` Liquid operators to conditionally include or exclude GitHub Enterprise content.
105+
Use the custom `ver_gt` and `ver_lt` Liquid operators to conditionally include or exclude GitHub Enterprise Server content.
62106

63107
- `ver_lt` stands for "version less than"
64-
- `ver_gt` stands for "version" greater than"
108+
- `ver_gt` stands for "version greater than"
65109

66110
See the [Semantic Versioning specification](https://semver.org/#spec-item-11) for more details on version precedence.
67111

68-
#### Including content in *all* supported versions
112+
If the Markdown source's `versions` front matter includes a version or versions of GitHub Enterprise Server and you want the content to display for those versions of GitHub Enterprise Server, do not include any Liquid logic at all. Deploying the site will automatically generate the HTML content for the supported versions of GitHub Enterprise Server.
69113

70-
If your content is included in all versions of Enterprise, you need not include any Liquid logic at all. The Markdown source will automatically generate the HTML content for all supported versions.
114+
#### Including content that *only applies to all supported versions of Enterprise Server*
71115

72-
#### Including content that *only applies to Dotcom*
73-
74-
If your content only applies to GitHub.com, such as billing information, use this logic:
116+
If your content only applies to Enterprise Server, and the content applies to all supported versions, such as subdomain isolation, use this logic:
75117

76118
```
77-
{% if currentVersion == "free-pro-team@latest" %}This is how you pay for your personal account, which is something you wouldn't do in Enterprise.{% endif %}
119+
{% if enterpriseServerVersions contains currentVersion %}Remember to isolate your subdomains, administrator.{% endif %}
78120
```
79121

80122
In this example:
81-
- `if currentVersion == "free-pro-team@latest"` will include the content for Dotcom output and *only* Dotcom.
123+
- `if enterpriseServerVersions contains currentVersion` checks to see if the version of the article you're viewing, `currentVersion`, is a supported version of Enterprise Server within an array of the supported versions of Enterprise Server, `enterpriseServerVersions`.
82124
- `{% endif %}` ends the statement.
83125

84-
#### Including content for *new Dotcom features* that will be included in Enterprise
126+
#### Including content for *new Dotcom features* that will be included in Enterprise Server
85127

86-
If your content is describing a new feature that was added to GitHub.com and will be automatically included in the next release of GitHub Enterprise, use this logic:
128+
If your content is describing a new feature that was added to GitHub.com and will be automatically included in the next release of GitHub Enterprise Server, use this logic:
87129

88130
```
89131
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}This is a brand new feature, the likes of which have never been seen at this company before!{% endif %}
@@ -92,10 +134,10 @@ If your content is describing a new feature that was added to GitHub.com and wil
92134
In this example:
93135

94136
- `if currentVersion == "free-pro-team@latest"` will include the content for GitHub.com output.
95-
- `or currentVersion ver_gt "enterprise-server@2.21"` will include the content for releases *after* Enterprise 2.21, which means the content will be included for 2.22+.
137+
- `or currentVersion ver_gt "enterprise-server@2.21"` will include the content for releases *after* Enterprise Server 2.21, which means the content will be included for 2.22+.
96138
- `{% endif %}` ends the statement.
97139

98-
#### Including content for *changed* Dotcom features that will also change in Enterprise
140+
#### Including content for *changed* Dotcom features that will also change in Enterprise Server
99141

100142
If your content is describing a change to existing functionality in Dotcom, such as changed UI text or a more simple means of completing a task, use this logic:
101143

@@ -106,11 +148,11 @@ If your content is describing a change to existing functionality in Dotcom, such
106148
In this example:
107149

108150
- `if currentVersion == "free-pro-team@latest"` will include the content for GitHub.com output.
109-
- `or currentVersion ver_gt "enterprise-server@2.21"` will include the content for releases *after* Enterprise 2.21, which means the content will be included for 2.22+.
151+
- `or currentVersion ver_gt "enterprise-server@2.21"` will include the content for releases *after* Enterprise Server 2.21, which means the content will be included for 2.22+.
110152
- `{% else %}` means if the above is NOT true, then display the content that follows, `This is the old way of doing things`.
111153
- `{% endif %}` ends the statement.
112154

113-
#### Including content for *changed* Dotcom features that will also change in Enterprise but don't exist in some older versions
155+
#### Including content for *changed* Dotcom features that will also change in Enterprise Server but don't exist in some older versions
114156

115157
If your content is describing a change to existing functionality in Dotcom, and that functionality doesn't exist in all older Enterprise versions, use logic like this:
116158

@@ -129,35 +171,78 @@ This is the old way of doing things (which did not exist before 2.20).
129171
In this example:
130172

131173
- `if currentVersion == "free-pro-team@latest"` will include the content for GitHub.com output.
132-
- `or currentVersion ver_gt "enterprise-server@2.20"` will include the content for releases *after* Enterprise 2.20, which means the content will be included for 2.21+.
174+
- `or currentVersion ver_gt "enterprise-server@2.20"` will include the content for releases *after* Enterprise Server 2.20, which means the content will be included for 2.21+.
133175
- `elsif currentVersion ver_gt "enterprise-server@2.19" and currentVersion ver_lt "enterprise-server@2.21"` means if the above is NOT true, and the version is 2.20, then display the content that follows, `This is the old way of doing things`. No content will be displayed for versions older than 2.20.
134176
- `{% endif %}` ends the statement.
135177

136-
#### Including content for *new Enterprise features* that don't exist on Dotcom
178+
#### Including content for *new Enterprise Server features* that don't exist on Dotcom
137179

138-
If your content is describing a new feature that was added to GitHub Enterprise but not GitHub, such as LDAP support, use this logic:
180+
If your content is describing a new feature that was added to GitHub Enterprise Server but not GitHub, such as LDAP support, use this logic:
139181

140182
```
141-
{% if currentVersion != "free-pro-team@latest" and currentVersion ver_gt "enterprise-server@2.21" %}This is a brand new feature, admin-type people!{% endif %}
183+
{% if currentVersion ver_gt "enterprise-server@2.21" %}This is a brand new feature, admin-type people!{% endif %}
142184
```
143185

144186
In this example:
145187

146188
- `if currentVersion != "free-pro-team@latest"` will exclude the content for GitHub.com output.
147-
- `and currentVersion ver_gt "enterprise-server@2.21"` will *additionally* include the content for releases *after* Enterprise 2.21, which means the content will be included for 2.22+.
189+
- `and currentVersion ver_gt "enterprise-server@2.21"` will *additionally* include the content for releases *after* Enterprise Server 2.21, which means the content will be included for 2.22+.
148190
- `{% endif %}` ends the statement.
149191

150-
#### Including content for *changed Enterprise features* that don't exist on Dotcom
192+
#### Including content for *changed Enterprise Server features* that don't exist on Dotcom
151193

152-
If your content is describing a change to existing functionality in GitHub Enterprise, such as changed UI text or a more simple means of completing a task in the Management Console, use this logic:
194+
If your content is describing a change to existing functionality in GitHub Enterprise Server, such as changed UI text or a more simple means of completing a task in the Management Console, use this logic:
153195

154196
```
155-
{% if currentVersion != "free-pro-team@latest" and currentVersion ver_gt "enterprise-server@2.21" %}This is the new way of doing things, admins! {% else %}This is the old way of doing things, admins! {% endif %}
197+
{% if currentVersion ver_gt "enterprise-server@2.21" %}This is the new way of doing things, admins! {% else %}This is the old way of doing things, admins! {% endif %}
156198
```
157199

158200
In this example:
159201

160202
- `if currentVersion != "free-pro-team@latest"` will exclude the content for GitHub.com output.
161-
- `and currentVersion ver_gt "enterprise-server@2.21"` will *additionally* include the content for releases *after* Enterprise 2.21, which means the content will be included for 2.22+.
203+
- `and currentVersion ver_gt "enterprise-server@2.21"` will *additionally* include the content for releases *after* Enterprise Server 2.21, which means the content will be included for 2.22+.
162204
- `{% else %}` means if the above is NOT true, then display the content that follows, `This is the old way of doing things, admins!`.
163205
- `{% endif %}` ends the statement.
206+
207+
### Liquid conditional statements for GitHub AE
208+
209+
If the Markdown source's `versions` front matter includes GitHub AE and you want the content to display for GitHub AE, do not include any Liquid logic at all. Deployment of the site will automatically generate the HTML content for GitHub AE.
210+
211+
#### Including content that *only applies to GitHub AE*
212+
213+
If your content only applies to GitHub AE, use this logic:
214+
215+
```
216+
{% if currentVersion == "github-ae@latest" %}This content describes something you can only do on GitHub AE.{% endif %}
217+
```
218+
219+
In this example:
220+
- `if currentVersion == "github-ae@latest"` will include the content for GitHub AE output and *only* GitHub AE.
221+
- `{% endif %}` ends the statement.
222+
223+
#### Including content that *only applies to GitHub AE and Enterprise Server*
224+
225+
If your content only applies to GitHub AE and all supported versions of GitHub Enterprise Server, use this logic:
226+
227+
```
228+
{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}This content describes something you can only do on GitHub Enterprise Server or GitHub AE.{% endif %}
229+
```
230+
231+
In this example:
232+
- `if enterpriseServerVersions contains currentVersion` will include the content for all supported versions of GitHub Enterprise Server.
233+
- `or currentVersion == "github-ae@latest"` will include the content for GitHub AE output.
234+
- `{% endif %}` ends the statement.
235+
236+
#### Including content for features that will be included in the *next release* of GitHub AE
237+
238+
If your content is describing a feature that will be included in the next release of GitHub AE, you can use a placeholder version string, `github-ae@next`. Before the next GitHub AE release, replace the instances of the placeholder with `github-ae@latest`. For example, you can use this logic:
239+
240+
```
241+
{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@next" %}This is a brand new feature, the likes of which have never been seen at this company before!{% endif %}
242+
```
243+
244+
In this example:
245+
246+
- `if currentVersion == "free-pro-team@latest"` will include the content for GitHub.com output.
247+
- `or currentVersion == "github-ae@next"` indicates that the content should also appear for the next release of GitHub AE, when we replace any instances of `github-ae@next` with `github-ae@latest`.
248+
- `{% endif %}` ends the statement.

0 commit comments

Comments
 (0)