diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php
index 5b404c31..046eba3a 100755
--- a/code/Model/SiteTree.php
+++ b/code/Model/SiteTree.php
@@ -1380,7 +1380,6 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
$tags['title'] = [
'tag' => 'title',
- 'attributes' => [],
'content' => $this->obj('Title')->forTemplate()
];
@@ -1442,7 +1441,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
{
$tags = [];
$tagsArray = $this->MetaComponents();
- if (!$includeTitle) {
+ if (!$includeTitle || strtolower($includeTitle) == 'false') {
unset($tagsArray['title']);
}
diff --git a/tests/php/Model/SiteTreeTest.php b/tests/php/Model/SiteTreeTest.php
index e914129a..03b85493 100644
--- a/tests/php/Model/SiteTreeTest.php
+++ b/tests/php/Model/SiteTreeTest.php
@@ -1353,6 +1353,57 @@ class SiteTreeTest extends SapphireTest
// Test without title
$meta = $page->MetaTags(false);
$this->assertNotContains('
', $meta);
+
+ $meta = $page->MetaTags('false');
+ $this->assertNotContains('', $meta);
+ }
+
+ public function testMetaComponents()
+ {
+ $this->logInWithPermission('ADMIN');
+ /** @var SiteTree $page */
+ $page = $this->objFromFixture('Page', 'metapage');
+
+ $charset = Config::inst()->get(ContentNegotiator::class, 'encoding');
+
+ $expected = [
+ 'title' => [
+ 'tag' => 'title',
+ 'content' => "HTML & XML",
+ ],
+ 'generator' => [
+ 'attributes' => [
+ 'name' => 'generator',
+ 'content' => Config::inst()->get(SiteTree::class, 'meta_generator')
+ ],
+ ],
+ 'contentType' => [
+ 'attributes' => [
+ 'http-equiv' => 'Content-Type',
+ 'content' => "text/html; charset=$charset",
+ ],
+ ],
+ 'description' => [
+ 'attributes' => [
+ 'name' => 'description',
+ 'content' => 'The
and
tags'
+ ]
+ ],
+ 'pageId' => [
+ 'attributes' => [
+ 'name' => 'x-page-id',
+ 'content' => $page->ID
+ ],
+ ],
+ 'cmsEditLink' => [
+ 'attributes' => [
+ 'name' => 'x-cms-edit-link',
+ 'content' => $page->CMSEditLink()
+ ]
+ ]
+ ];
+
+ $this->assertEquals($expected, $page->MetaComponents());
}
/**