Wallogit.com
2017 © Pedro Peláez
Kirby 3 Plugin for a best-practice HTML Head Element extendable with snippets.
Kirby Plugin for a best-practice HTML Head Element extendable with snippets., (*2)
site/plugins/kirby3-htmlhead orgit submodule add https://github.com/bnomei/kirby3-htmlhead.git site/plugins/kirby3-htmlhead orcomposer require bnomei/kirby3-htmlheadUse the htmlhead() helper to add meta tags, link tags, script tags, etc. to the head of your HTML document. The helper performs a little bit of magic and is actually calling regular Kirby snippets. This way, you can mix and match the helper with your own snippets., (*3)
[!TIP] The order of the tags in the code example is based on best practices. You might want to stick to it as closely as possible and append your own at the end., (*4)
<!DOCTYPE html>
<html>
<head>
<?= htmlhead()
->recommended_minimum()
->title()
->base()
// ->link_preconnect(...)
->script_js_async(['/assets/app-async.js'])
->script_js(['/assets/app.js'])
->link_css(['/assets/app.css'])
// ->link_a11ycss()
// ->link_csswizardry_ct()
// ->link_preload(...)
// ->script_js_defer(['/assets/app-defer.js'])
// ->link_prefetch(...)
// ->link_prerender(...)
// ->link_canonical(...)
// ->link_alternates(...)
->meta_robots()
->meta_author(site()->author())
->meta_description($page->seoDesc())
->meta_opengraph(description: $page->seoDesc())
->link_feedrss()
// site/snippets/my-snippet.php
->my_snippet(['key' => 'value'])
?>
</head>
<body>
<!-- ... -->
</body>
</html>
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue., (*5)
MIT, (*6)
It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech., (*7)