Rename $pageMetadata to $metadata

This commit is contained in:
Ruben 2026-05-10 22:02:48 +02:00
parent a8141746d9
commit df912a4da0
4 changed files with 15 additions and 15 deletions

View file

@ -103,7 +103,7 @@ Dette betyr:
| Variabel | Type | Beskrivelse | | Variabel | Type | Beskrivelse |
|----------|------|-------------| |----------|------|-------------|
| `$content` | string | Innholdet som skal vises | | `$content` | string | Innholdet som skal vises |
| `$pageMetadata` | array | Metadata for siden | | `$metadata` | array | Metadata for siden |
| `$pageTitle` | string | Sidens tittel | | `$pageTitle` | string | Sidens tittel |
### I list.php ### I list.php

View file

@ -62,9 +62,9 @@ Eksempel:
```php ```php
<article class="page-content"> <article class="page-content">
<?php if ($pageMetadata && isset($pageMetadata['title'])): ?> <?php if (!empty($metadata) && isset($metadata['title'])): ?>
<header> <header>
<h1><?= htmlspecialchars($pageMetadata['title']) ?></h1> <h1><?= htmlspecialchars($metadata['title']) ?></h1>
</header> </header>
<?php endif; ?> <?php endif; ?>
@ -117,7 +117,7 @@ Hvis `/app/custom/` ikke eksisterer, bruker PnP standardmaler fra `/app/default/
### I `page.php`: ### I `page.php`:
- `$content` - Sideinnholdet - `$content` - Sideinnholdet
- `$pageMetadata` - Metadata for siden - `$metadata` - Metadata for siden
- `$pageTitle` - Sidens tittel - `$pageTitle` - Sidens tittel
### I `list.php`: ### I `list.php`:

View file

@ -1,23 +1,23 @@
<article> <article>
<?= $content ?> <?= $content ?>
<?php if ($pageMetadata && (isset($pageMetadata['tags']) || isset($pageMetadata['categories']))): ?> <?php if (!empty($metadata) && (isset($metadata['tags']) || isset($metadata['categories']))): ?>
<aside class="metadata"> <aside class="metadata">
<?php if (!empty($pageMetadata['categories'])): ?> <?php if (!empty($metadata['categories'])): ?>
<div class="categories"> <div class="categories">
<strong><?= htmlspecialchars($translations['categories'] ?? 'Categories') ?>:</strong> <strong><?= htmlspecialchars($translations['categories'] ?? 'Categories') ?>:</strong>
<?php <?php
$categories = array_map('trim', explode(',', $pageMetadata['categories'])); $categories = array_map('trim', explode(',', $metadata['categories']));
echo implode(', ', array_map('htmlspecialchars', $categories)); echo implode(', ', array_map('htmlspecialchars', $categories));
?> ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($pageMetadata['tags'])): ?> <?php if (!empty($metadata['tags'])): ?>
<div class="tags"> <div class="tags">
<strong><?= htmlspecialchars($translations['tags'] ?? 'Tags') ?>:</strong> <strong><?= htmlspecialchars($translations['tags'] ?? 'Tags') ?>:</strong>
<?php <?php
$tags = array_map('trim', explode(',', $pageMetadata['tags'])); $tags = array_map('trim', explode(',', $metadata['tags']));
echo implode(', ', array_map('htmlspecialchars', $tags)); echo implode(', ', array_map('htmlspecialchars', $tags));
?> ?>
</div> </div>

View file

@ -61,7 +61,7 @@ These are extracted via `extract()` so they're direct PHP variables:
| Variable | Type | Description | | Variable | Type | Description |
|---|---|---| |---|---|---|
| `$content` | string | Rendered page content HTML | | `$content` | string | Rendered page content HTML |
| `$pageMetadata` | array | Full metadata array from `metadata.ini` | | `$metadata` | array | Full metadata array from `metadata.ini` |
## Additional Variables in list-*.php Templates ## Additional Variables in list-*.php Templates