MDL-49891 theme_bootstrapbase: Add meta data description to frontpage

This commit is contained in:
John Okely 2015-08-11 12:04:07 +08:00
parent dda862abb5
commit 5e9a937bba
2 changed files with 23 additions and 0 deletions

View File

@ -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 <head> 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 .= "<meta name=\"description\" content=\"$summary\" />\n";
}
}
return $output;
}
/*
* This renders the navbar.
* Uses bootstrap compatible html.

View File

@ -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 ===