Use Page::metadata() from templates

This commit is contained in:
Giuseppe Criscione 2019-05-06 01:01:51 +02:00
parent 45270012e7
commit 9b5abe9d3c
2 changed files with 10 additions and 1 deletions

View File

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="<?= $site->lang() ?>">
<head>
<meta charset="utf-8">
<title><?= $page->title() ?> | <?= $site->title() ?></title>
<?= $this->insert('_meta') ?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="<?= $this->assets()->uri('css/style.min.css') ?>">
<script src="<?= $this->assets()->uri('js/script.min.js') ?>"></script>

View File

@ -0,0 +1,9 @@
<?php foreach ($page->metadata() as $meta): ?>
<?php if ($meta->isCharset()): ?>
<meta charset="<?= $meta->content() ?>">
<?php elseif ($meta->isHTTPEquiv()): ?>
<meta http-equiv="<?= $meta->name() ?>" content="<?= $meta->content() ?>">
<?php else: ?>
<meta <?= $meta->namespace() === 'og' ? 'property' : 'name' ?>="<?= $meta->name() ?>" content="<?= $meta->content() ?>">
<?php endif; ?>
<?php endforeach; ?>