]> git.bts.cx Git - cx.git/commitdiff
Added post title to page title
authorBen Sherratt <redacted>
Wed, 30 Aug 2023 19:55:58 +0000 (20:55 +0100)
committerBen Sherratt <redacted>
Wed, 30 Aug 2023 19:55:58 +0000 (20:55 +0100)
cx/templates/public/base.php
cx/templates/public/post.php

index 83fef3d3b3f21218afb2a7f852a2f97366c22c98..d031247a2463a16dec049b55ca6858141615afd4 100644 (file)
@@ -5,13 +5,19 @@
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+       <?php if (isset($cx_post_title)): ?>
+       <title><?= cx_site_name(); ?> - <?= $cx_post_title; ?></title>
+       <?php else: ?>
        <title><?= cx_site_name(); ?></title>
+       <?php endif; ?>
+
        <link rel="stylesheet" href="<?= cx_url('/design/css/style.css') ?>">
        <link rel="alternate" type="application/rss+xml" title="bts.cx" href="<?= cx_url('/feed/') ?>" />
 
        <?php if (isset($cx_post_meta)): ?>
        
-       <meta property="og:title" content="<?= cx_site_name(); ?>">
+       <meta property="og:title" content="<?= cx_site_name(); ?> - <?= $cx_post_title; ?>">
        <meta property="og:type" content="article" />
        <meta property="og:image" content="<?= $cx_post_meta->hero_image; ?>">
        <meta property="og:url" content="<?= cx_url_site($cx_post_permalink); ?>">
index f44cb29046f0391c86aa027aabf90f9edbfbfd35..4b7993d9b3bf5f68a977d04e8ae704113182bf4e 100644 (file)
@@ -1,7 +1,7 @@
 <?php $post = cx_posts_find_post($post_id); ?>
 <?php $post_metadata = $post->get_metadata(); ?>
 <?php $post_permalink = '/' . date('Y', $post->date) . '/' . date('m', $post->date) . '/' . $post->slug; ?>
-<?php cx_template_base('base', ['cx_post_meta' => $post_metadata, 'cx_post_permalink' => $post_permalink]); ?>
+<?php cx_template_base('base', ['cx_post_title' => $post->title, 'cx_post_meta' => $post_metadata, 'cx_post_permalink' => $post_permalink]); ?>
 <main>
 <?php if ($post): ?>
        <article>