<article>
<?= $content ?>

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