From 5e9a937bba9c4d17829e05f6648b0536260eccdc Mon Sep 17 00:00:00 2001 From: John Okely Date: Tue, 11 Aug 2015 12:04:07 +0800 Subject: [PATCH] MDL-49891 theme_bootstrapbase: Add meta data description to frontpage --- .../bootstrapbase/renderers/core_renderer.php | 20 +++++++++++++++++++ theme/upgrade.txt | 3 +++ 2 files changed, 23 insertions(+) diff --git a/theme/bootstrapbase/renderers/core_renderer.php b/theme/bootstrapbase/renderers/core_renderer.php index fc1485436b9..68b146e3948 100644 --- a/theme/bootstrapbase/renderers/core_renderer.php +++ b/theme/bootstrapbase/renderers/core_renderer.php @@ -27,6 +27,26 @@ class theme_bootstrapbase_core_renderer extends core_renderer { /** @var custom_menu_item language The language menu if created */ protected $language = null; + /** + * The standard tags that should be included in the tag + * including a meta description for the front page + * + * @return string HTML fragment. + */ + public function standard_head_html() { + global $SITE, $PAGE; + + $output = parent::standard_head_html(); + if ($PAGE->pagelayout == 'frontpage') { + $summary = s(strip_tags(format_text($SITE->summary, FORMAT_HTML))); + if (!empty($summary)) { + $output .= "\n"; + } + } + + return $output; + } + /* * This renders the navbar. * Uses bootstrap compatible html. diff --git a/theme/upgrade.txt b/theme/upgrade.txt index ba34087c357..e8622a54c9a 100644 --- a/theme/upgrade.txt +++ b/theme/upgrade.txt @@ -6,6 +6,9 @@ information provided here is intended especially for theme designer. * The renderer function core_availability_renderer::multiple_messages was changed to render_core_availability_multiple_messages, requiring a parameter of the new \core_availability\multiple_messages type. +* Meta description is now included in standard_head_html for homepage in bootstrapbase. + If your theme includes a meta description directly in a layout for the frontpage, + you will need to remove it or override the standard_head_html instead. === 2.9 ===