Add page-specific JavaScript support
Update documentation for new JS variables and rendering pipeline Add script.js file support to content directories Implement cache-busting for JavaScript files Update static file serving to include JavaScript files Document page-specific script loading in base.php
This commit is contained in:
parent
f8a352afce
commit
f1447049e4
6 changed files with 70 additions and 7 deletions
|
|
@ -211,6 +211,27 @@ MD5 hash of page-specific CSS for cache busting.
|
|||
**Optional:** Only set if `$pageCssUrl` exists
|
||||
**Example:** See `$pageCssUrl` above
|
||||
|
||||
### `$pageJsUrl`
|
||||
|
||||
URL to page-specific JavaScript file.
|
||||
|
||||
**Type:** String (URL)
|
||||
**Optional:** Only set if `script.js` exists in content directory
|
||||
**Example:**
|
||||
```php
|
||||
<?php if (!empty($pageJsUrl)): ?>
|
||||
<script defer src="<?= htmlspecialchars($pageJsUrl) ?>?v=<?= htmlspecialchars($pageJsHash ?? '') ?>"></script>
|
||||
<?php endif; ?>
|
||||
```
|
||||
|
||||
### `$pageJsHash`
|
||||
|
||||
MD5 hash of page-specific JavaScript for cache busting.
|
||||
|
||||
**Type:** String (MD5 hash)
|
||||
**Optional:** Only set if `$pageJsUrl` exists
|
||||
**Example:** See `$pageJsUrl` above
|
||||
|
||||
### `$feedUrl`
|
||||
|
||||
URL to the Atom feed for the current list page.
|
||||
|
|
@ -415,6 +436,8 @@ Then use in templates:
|
|||
| `$translations` | ✓ | — | — |
|
||||
| `$pageCssUrl` | ✓ | — | — |
|
||||
| `$pageCssHash` | ✓ | — | — |
|
||||
| `$pageJsUrl` | ✓ | — | — |
|
||||
| `$pageJsHash` | ✓ | — | — |
|
||||
| `$feedUrl` | ✓ | — | — |
|
||||
| `$metadata` | — | ✓ | ✓ |
|
||||
| `$pageContent` | — | — | ✓ |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue