You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The variables you use can come from several different data sources, such as:</p>
301
301
<ul>
302
302
<li>that very file (<code>{% raw %}{% set myText = "Hello World!" %}{% endraw %}</code>)</li>
@@ -312,7 +312,7 @@ <h2 id="data">Using Data (Optional)</h2>
312
312
<blockquoteclass="help">
313
313
If you don't know JSON syntax: don't worry. It's pretty much self-explanatory if you know JavaScript. As usual, <code>[]</code> are arrays and <code>{}</code> are objects.
314
314
</blockquote>
315
-
<p>Example: <code>changelog.json</code></p>
315
+
<p>Example: <code>_data/changelog.json</code></p>
316
316
<pre><code>[
317
317
{ "date": "2024-12-07", "text": "Created page" },
318
318
{ "date": "2024-12-08", "text": "Bugfixes" },
@@ -327,6 +327,18 @@ <h2 id="data">Using Data (Optional)</h2>
327
327
</code></pre>
328
328
<p>(This would output a list of all objects in the <code>changelog.json</code> file.)</p>
329
329
<p>There are also other ways to get data. If you're interested read <atarget="_blank" href="https://www.11ty.dev/docs/data/#sources-of-data">the documentation</a>.</p>
330
+
331
+
<hr/>
332
+
<h3id="cachebusting">Cachebusting</h3>
333
+
334
+
<p><b>Tip:</b> For cachebusting, instead of manually updating the <code>?nocache=</code> parameter, you can add the current date and time to your files like so:</p>
335
+
<pre><codeclass="language-html"><script src="example.js{% raw %}{{ nocache }}{% endraw %}"></script>
336
+
<link rel="stylesheet" href="example.css{% raw %}{{ nocache }}{% endraw %}" /></code
337
+
></pre>
338
+
<p><code>{% raw %}{{ nocache }}{% endraw %}</code> will render something like <code>?nocache=123</code>, 123 being the current timestamp.</p>
339
+
<p>For this to work you need to create a data file: <code>_data/nocache.js</code> only has one line:</p>
0 commit comments