forked from jekyll/jekyll
/
index.html
300 lines (285 loc) · 14.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link type="application/atom+xml" rel="alternate" href="https://jekyllrb.com/feed.xml" title="Jekyll • Simple, blog-aware, static sites" />
<link type="application/atom+xml" rel="alternate" href="/feed/release.xml" title="Jekyll releases posts" />
<link rel="alternate" type="application/atom+xml" title="Recent commits to Jekyll’s master branch" href="https://github.com/jekyll/jekyll/commits/master.atom">
<link rel="preload" href="/fonts/lato-v14-latin-300.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="/fonts/lato-v14-latin-700.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="/css/screen.css" as="style">
<link rel="stylesheet" href="/css/screen.css">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<!-- Begin Jekyll SEO tag v2.7.1 -->
<title>Environments | Jekyll • Simple, blog-aware, static sites</title>
<meta name="generator" content="Jekyll v4.1.1" />
<meta property="og:title" content="Environments" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="In the build (or serve) arguments, you can specify a Jekyll environment and value. The build will then apply this value in any conditional statements in your content." />
<meta property="og:description" content="In the build (or serve) arguments, you can specify a Jekyll environment and value. The build will then apply this value in any conditional statements in your content." />
<link rel="canonical" href="https://jekyllrb.com/docs/configuration/environments/" />
<meta property="og:url" content="https://jekyllrb.com/docs/configuration/environments/" />
<meta property="og:site_name" content="Jekyll • Simple, blog-aware, static sites" />
<meta property="og:image" content="https://jekyllrb.com/img/jekyll-og.png" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-12-04T16:31:20-08:00" />
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:image" content="https://jekyllrb.com/img/jekyll-og.png" />
<meta property="twitter:title" content="Environments" />
<meta name="twitter:site" content="@jekyllrb" />
<meta name="google-site-verification" content="onQcXpAvtHBrUI5LlroHNE_FP0b2qvFyPq7VZw36iEY" />
<script type="application/ld+json">
{"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://jekyllrb.com/img/logo-2x.png"}},"description":"In the build (or serve) arguments, you can specify a Jekyll environment and value. The build will then apply this value in any conditional statements in your content.","url":"https://jekyllrb.com/docs/configuration/environments/","@type":"BlogPosting","headline":"Environments","dateModified":"2020-12-04T16:31:20-08:00","datePublished":"2020-12-04T16:31:20-08:00","image":"https://jekyllrb.com/img/jekyll-og.png","mainEntityOfPage":{"@type":"WebPage","@id":"https://jekyllrb.com/docs/configuration/environments/"},"@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<!--[if lt IE 9]>
<script src="/js/html5shiv.min.js"></script>
<script src="/js/respond.min.js"></script>
<![endif]-->
</head>
<body class="wrap"><header>
<div class="flexbox">
<div class="center-on-mobiles">
<h1>
<a href="/" class="logo">
<span class="sr-only">Jekyll</span>
<img src="/img/logo-2x.png" width="140" height="65" alt="Jekyll Logo">
</a>
</h1>
</div>
<nav class="main-nav hide-on-mobiles">
<ul>
<li><a href="/">Home</a></li>
<li class="current"><a href="/docs/">Docs</a></li>
<li><a href="/resources/">Resources</a></li>
<li><a href="/showcase/">Showcase</a></li>
<li><a href="/news/">News</a></li>
</ul>
</nav>
<div class="search hide-on-mobiles">
<input type="text" id="docsearch-input" placeholder="Search the docs…">
</div>
<div class="meta hide-on-mobiles">
<ul>
<li><a href="https://github.com/jekyll/jekyll/releases/tag/v4.1.1">v4.1.1</a></li>
<li><a href="https://github.com/jekyll/jekyll">GitHub</a></li>
</ul>
</div>
</div>
<nav class="mobile-nav show-on-mobiles">
<ul>
<li><a href="/">Home</a></li>
<li class="current" ><a href="/docs/">Docs</a></li>
<li><a href="/resources/">Resources</a></li>
<li><a href="/news/">News</a></li>
<li><a href="https://github.com/jekyll/jekyll">GitHub</a></li>
</ul>
</nav>
</header>
<section class="docs">
<div class="grid">
<div class="docs-nav-mobile unit whole show-on-mobiles">
<select onchange="if (this.value) window.location.href=this.value">
<option value="">Navigate the docs…</option>
<optgroup label="Getting Started">
<option value="/docs/">Quickstart</option>
<option value="/docs/installation/">Installation</option>
<option value="/docs/ruby-101/">Ruby 101</option>
<option value="/docs/community/">Community</option>
<option value="/docs/step-by-step/01-setup/">Step by Step Tutorial</option>
</optgroup>
<optgroup label="Build">
<option value="/docs/usage/">Command Line Usage</option>
<option value="/docs/configuration/">Configuration</option>
<option value="/docs/rendering-process/">Rendering Process</option>
</optgroup>
<optgroup label="Content">
<option value="/docs/pages/">Pages</option>
<option value="/docs/posts/">Posts</option>
<option value="/docs/front-matter/">Front Matter</option>
<option value="/docs/collections/">Collections</option>
<option value="/docs/datafiles/">Data Files</option>
<option value="/docs/assets/">Assets</option>
<option value="/docs/static-files/">Static Files</option>
</optgroup>
<optgroup label="Site Structure">
<option value="/docs/structure/">Directory Structure</option>
<option value="/docs/liquid/">Liquid</option>
<option value="/docs/variables/">Variables</option>
<option value="/docs/includes/">Includes</option>
<option value="/docs/layouts/">Layouts</option>
<option value="/docs/permalinks/">Permalinks</option>
<option value="/docs/themes/">Themes</option>
<option value="/docs/pagination/">Pagination</option>
</optgroup>
<optgroup label="Guides">
<option value="/docs/plugins/">Plugins</option>
<option value="/docs/migrations/">Blog Migrations</option>
<option value="/docs/upgrading/">Upgrading</option>
<option value="/docs/deployment/">Deployment</option>
</optgroup>
</select>
</div>
<div class="unit four-fifths">
<article>
<div class="improve right hide-on-mobiles">
<a data-proofer-ignore href="https://github.com/jekyll/jekyll/edit/master/docs/_docs/configuration/environments.md"><i
class="fa fa-pencil"></i> Improve this page</a>
</div>
<h1>Environments</h1>
<p>In the <code class="language-plaintext highlighter-rouge">build</code> (or <code class="language-plaintext highlighter-rouge">serve</code>) arguments, you can specify a Jekyll environment
and value. The build will then apply this value in any conditional statements
in your content.</p>
<p>For example, suppose you set this conditional statement in your code:</p>
<div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{%</span><span class="w"> </span><span class="kr">if</span><span class="w"> </span><span class="nv">jekyll</span><span class="p">.</span><span class="nv">environment</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">"production"</span><span class="w"> </span><span class="p">%}</span>
<span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span>disqus.html<span class="w"> </span><span class="p">%}</span>
<span class="p">{%</span><span class="w"> </span><span class="kr">endif</span><span class="w"> </span><span class="p">%}</span>
</code></pre></div></div>
<p>When you build your Jekyll site, the content inside the <code class="language-plaintext highlighter-rouge">if</code> statement won’t be
run unless you also specify a <code class="language-plaintext highlighter-rouge">production</code> environment in the build command,
like this:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">JEKYLL_ENV</span><span class="o">=</span>production jekyll build
</code></pre></div></div>
<p>Specifying an environment value allows you to make certain content available
only within specific environments.</p>
<p>The default value for <code class="language-plaintext highlighter-rouge">JEKYLL_ENV</code> is <code class="language-plaintext highlighter-rouge">development</code>. Therefore if you omit
<code class="language-plaintext highlighter-rouge">JEKYLL_ENV</code> from the build arguments, the default value will be
<code class="language-plaintext highlighter-rouge">JEKYLL_ENV=development</code>. Any content inside
<code class="language-plaintext highlighter-rouge">{% if jekyll.environment == "development" %}</code> tags will
automatically appear in the build.</p>
<p>Your environment values can be anything you want (not just <code class="language-plaintext highlighter-rouge">development</code> or
<code class="language-plaintext highlighter-rouge">production</code>). Some elements you might want to hide in development
environments include Disqus comment forms or Google Analytics. Conversely,
you might want to expose an “Edit me in GitHub” button in a development
environment but not include it in production environments.</p>
<p>By specifying the option in the build command, you avoid having to change
values in your configuration files when moving from one environment to another.</p>
<p class="note">To switch part of your config settings depending on the environment, use the
<a href="/docs/configuration/options/#build-command-options">build command option</a>,
for example <code>--config _config.yml,_config_development.yml</code>. Settings
in later files override settings in earlier files.</p>
</article>
</div>
<div class="unit one-fifth hide-on-mobiles">
<aside>
<h4>Getting Started</h4>
<ul>
<li><a href="/docs/">Quickstart</a></li>
<li><a href="/docs/installation/">Installation</a></li>
<li><a href="/docs/ruby-101/">Ruby 101</a></li>
<li><a href="/docs/community/">Community</a></li>
<li><a href="/docs/step-by-step/01-setup/">Step by Step Tutorial</a></li>
</ul>
<h4>Build</h4>
<ul>
<li><a href="/docs/usage/">Command Line Usage</a></li>
<li><a href="/docs/configuration/">Configuration</a></li>
<li><a href="/docs/rendering-process/">Rendering Process</a></li>
</ul>
<h4>Content</h4>
<ul>
<li><a href="/docs/pages/">Pages</a></li>
<li><a href="/docs/posts/">Posts</a></li>
<li><a href="/docs/front-matter/">Front Matter</a></li>
<li><a href="/docs/collections/">Collections</a></li>
<li><a href="/docs/datafiles/">Data Files</a></li>
<li><a href="/docs/assets/">Assets</a></li>
<li><a href="/docs/static-files/">Static Files</a></li>
</ul>
<h4>Site Structure</h4>
<ul>
<li><a href="/docs/structure/">Directory Structure</a></li>
<li><a href="/docs/liquid/">Liquid</a></li>
<li><a href="/docs/variables/">Variables</a></li>
<li><a href="/docs/includes/">Includes</a></li>
<li><a href="/docs/layouts/">Layouts</a></li>
<li><a href="/docs/permalinks/">Permalinks</a></li>
<li><a href="/docs/themes/">Themes</a></li>
<li><a href="/docs/pagination/">Pagination</a></li>
</ul>
<h4>Guides</h4>
<ul>
<li><a href="/docs/plugins/">Plugins</a></li>
<li><a href="/docs/migrations/">Blog Migrations</a></li>
<li><a href="/docs/upgrading/">Upgrading</a></li>
<li><a href="/docs/deployment/">Deployment</a></li>
</ul>
</aside>
</div>
<div class="clear"></div>
</div>
</section>
<footer>
<div class="grid">
<div class="unit one-third center-on-mobiles">
<p>Jekyll is lovingly maintained by the <a href="/team/">core team</a> of volunteers. </p>
<p>The contents of this website are <br />© 2020 under the terms of the <a href="https://github.com/jekyll/jekyll/blob/master/LICENSE">MIT License</a>.</p>
</div>
<div class="unit two-thirds align-right center-on-mobiles">
<p>
Proudly hosted by
<a href="https://github.com">
<img src="/img/footer-logo.png" width="100" height="30" alt="GitHub • Social coding">
</a>
</p>
</div>
<div class="unit two-thirds align-right center-on-mobiles">
<p>
Jekyll is funded thanks to its
<a href="https://github.com/jekyll/jekyll#sponsors">
sponsors!
</a>
</p>
</div>
</div>
</footer>
<script>
var anchorForId = function (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>";
anchor.title = "Permalink";
return anchor;
};
var linkifyAnchors = function (level, containingElement) {
var headers = containingElement.getElementsByTagName("h" + level);
for (var h = 0; h < headers.length; h++) {
var header = headers[h];
if (typeof header.id !== "undefined" && header.id !== "") {
header.appendChild(anchorForId(header.id));
}
}
};
document.onreadystatechange = function () {
if (this.readyState === "complete") {
var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0];
if (!contentBlock) {
return;
}
for (var level = 1; level <= 6; level++) {
linkifyAnchors(level, contentBlock);
}
}
};
</script>
<!-- Google Analytics (https://www.google.com/analytics) -->
<script>
!function(j,e,k,y,l,L){j.GoogleAnalyticsObject=y,j[y]||(j[y]=function(){
(j[y].q=j[y].q||[]).push(arguments)}),j[y].l=+new Date,l=e.createElement(k),
L=e.getElementsByTagName(k)[0],l.src='https://www.google-analytics.com/analytics.js',
L.parentNode.insertBefore(l,L)}(window,document,'script','ga');
ga('create', 'UA-50755011-1', 'jekyllrb.com');
ga('send', 'pageview');
</script>
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script> docsearch({
apiKey: '50fe39c839958dfad797000f33e2ec17',
indexName: 'jekyllrb',
inputSelector: '#docsearch-input',
enhancedSearchInput: true,
debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
</body>
</html>