Inladen via hook_page_attachments_alter ipv via html.twig
/**
* Implements hook_page_attachments_alter().
*
* Trim metatag description to 160 characters.
*/
function basetheme_page_attachments_alter(array &$attachments) {
// Load Adobe typekit font css without blocking render.
$kit = 'https://use.typekit.net/ehf4afy.css';
$head = &$attachments['#attached']['html_head'];
// Preconnects: font files are fetched with CORS, the CSS files without.
$head[] = [[
'#tag' => 'link',
'#attributes' => ['rel' => 'preconnect', 'href' => 'https://use.typekit.net', 'crossorigin' => TRUE],
], 'typekit_preconnect_fonts'];
$head[] = [[
'#tag' => 'link',
'#attributes' => ['rel' => 'preconnect', 'href' => 'https://use.typekit.net'],
], 'typekit_preconnect_css'];
$head[] = [[
'#tag' => 'link',
'#attributes' => ['rel' => 'preconnect', 'href' => 'https://p.typekit.net'],
], 'typekit_preconnect_p'];
// Non-blocking stylesheet.
$head[] = [[
'#tag' => 'link',
'#attributes' => [
'rel' => 'stylesheet',
'href' => $kit,
'media' => 'print',
'onload' => "this.media='all'",
],
], 'typekit_css'];
// Fallback for visitors without JavaScript.
$head[] = [[
'#tag' => 'link',
'#noscript' => TRUE,
'#attributes' => ['rel' => 'stylesheet', 'href' => $kit],
], 'typekit_css_noscript'];
}
Er hoeft geen enkele verwijzing te zijn in html.html.twig naar typekit.