【发布时间】:2016-03-10 10:25:01
【问题描述】:
我想向我的网站添加元标记。
我在我的 THEME.theme 文件中添加了这段代码并清除了缓存。
/**
* Implements hook_page_attachments_alter().
*
* Include meta tags and fonts using attachment method.
*/
function bartik_page_attachments_alter(array &$page) {
$font_attributes = array(
'rel' => 'stylesheet',
'type' => 'text/css',
'href' => 'https://fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700',
);
$page['#attached']['html_head_link'][] = array($font_attributes);
$rendering_meta = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'SKYPE_TOOLBAR',
'content' => 'SKYPE_TOOLBAR_PARSER_COMPATIBLE',
),
);
$page['#attached']['html_head'][] = [$rendering_meta, 'rendering_meta'];
}
此代码只是将元标记附加到登录页面。
如何将元标记添加到所有网站页面?
【问题讨论】: