Closed bvdputte closed 6 years ago
Here's what I use:
c::set('meta-tags.default', function(Page $page, Site $site) {
return [
'link' => [
'prefetch' => [
['href' => 'https://use.typekit.net'],
['href' => 'https://some.other-domain.tld'],
],
'preconnect' => [
['href' => 'https://use.typekit.net'],
['href' => 'https://some.other-domain.tld'],
],
],
];
});
Ah yes, of course. This works then. Thx!
But, is it expected if I want to extend
this via template specific meta-tags config that I'ld have to redefine everything which is already defined in the default config?
e.g.:
c::set('meta-tags.default', function(Page $page, Site $site) {
return [
'link' => [
'prefetch' => [
['href' => 'https://use.typekit.net'],
],
'preconnect' => [
['href' => 'https://use.typekit.net'],
],
],
];
});
icw
c::set('meta-tags.templates', function(Page $page, Site $site) {
'sometemplate' => function($page, $site) {
return [
'link' => [
'prefetch' => [
['href' => 'https://use.typekit.net'], // already defined in default ?
['href' => 'https://some.other-domain.tld']
],
'preconnect' => [
['href' => 'https://use.typekit.net'], // already defined in default ?
['href' => 'https://some.other-domain.tld']
],
],
];
}
});
When I do not add the typekit domains again in the meta-tags.templates
config, they are not being output.
This probably due to the array_merge that's happening. Not really sure if you can workaround that easily. If not, maybe make this more obvious somewhere?
Nevermind. Upgrading to Kirby 2.5.12 fixed this.
Probably something in the a
array helper class in the toolkit.
I would like to use multiple "prefetch" and "preconnect" links:
e.g.:
Only the last are being printed :-S