bnomei / kirby3-htmlhead
Kirby Plugin for a best-practice HTML Head Element extendable with snippets.
Installs: 3 394
Dependents: 0
Suggesters: 1
Security: 0
Stars: 20
Watchers: 1
Forks: 0
Open Issues: 1
Type:kirby-plugin
Requires
- php: >=8.2
- getkirby/composer-installer: ^1.2
Requires (Dev)
- getkirby/cms: ^5.0.0-alpha.4
- larastan/larastan: ^v3.0.0
- laravel/pint: ^1.13
- pestphp/pest: ^v3.5.1
- spatie/ray: ^1.39
- dev-master
- 5.0.1
- 5.0.0
- 3.3.4
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.2
- 3.0.0
- 2.1.13
- 2.1.11
- 2.1.10
- 2.1.9
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.7.8
- 1.7.7
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.6
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.4
- 1.5.2
- 1.5.1
- dev-dependabot/composer/guzzlehttp/psr7-2.5.0
This package is auto-updated.
Last update: 2024-11-30 09:57:22 UTC
README
Kirby Plugin for a best-practice HTML Head Element extendable with snippets.
Installation
- unzip master.zip as folder
site/plugins/kirby3-htmlhead
or git submodule add https://github.com/bnomei/kirby3-htmlhead.git site/plugins/kirby3-htmlhead
orcomposer require bnomei/kirby3-htmlhead
Usage
Use 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.
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.
<!DOCTYPE html> <html> <head> <?= htmlhead() ->recommended_minimum() ->title() ->base() // ->link_preconnect(...) ->script_js(['/assets/app-async.js'], async: true) ->script_js(['/assets/app.js']) ->link_css(['/assets/app.css']) // ->link_a11ycss() // ->link_csswizardry_ct() // ->link_preload(...) // ->script_js(['/assets/app-defer.js'], defer: true) // ->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>
Resources
- https://htmlhead.dev
- https://csswizardry.com/ct/
- https://x.com/csswizardry/status/1440710328266858500
- https://speakerdeck.com/csswizardry/get-your-head-straight?slide=39
Disclaimer
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.
License
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.