Skip to content

Commit 1fe69ae

Browse files
committed
preloadSingles clarification
1 parent c9ae078 commit 1fe69ae

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/5.x/reference/twig/global-variables.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,17 @@ They will be represented as <craft5:craft\elements\GlobalSet> objects.
434434

435435
### Singles
436436

437-
Your [single](../element-types/entries.md#singles) section entries can also be loaded automatically by setting <config5:preloadSingles> to `true`.
437+
Your [single section](../element-types/entries.md#singles) entries can also be loaded automatically by setting <config5:preloadSingles> to `true`. This makes them available by handle in all Twig contexts, just as global sets are. For example, if you had an “About Us” single with the handle `about`, you could access content from that entry in your footer, without setting up a query:
438+
439+
```twig{3}
440+
<footer>
441+
&copy;{{ now|date('Y') }}
442+
{{ about.phoneNumber }}
443+
</footer>
444+
445+
::: tip
446+
When you convert a global set to a single using the [`entrify/global-set` command](../cli.md#entrify-global-set), template references should remain compatible, so long as <config5:preloadSingles> is enabled.
447+
:::
438448
439449
### Other Elements
440450

0 commit comments

Comments
 (0)