<?php if (!empty($ctx->breadcrumbs) && empty($ctx->get('hide_breadcrumb'))): ?>
<nav class="breadcrumb" aria-label="Breadcrumb">
    <ol>
        <?php foreach ($ctx->breadcrumbs as $crumb): ?>
        <li>
            <a href="<?= htmlspecialchars($crumb['url']) ?>"><?= htmlspecialchars($crumb['title']) ?></a>
        </li>
        <?php endforeach; ?>
    </ol>
</nav>
<?php endif; ?>

<article>
<?= $content ?>

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

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