2017 © Pedro Peláez
 

plugin kirby3-htmlhead

Kirby 3 Plugin for a best-practice HTML Head Element extendable with snippets.

image

bnomei/kirby3-htmlhead

Kirby 3 Plugin for a best-practice HTML Head Element extendable with snippets.

  • Saturday, July 28, 2018
  • by bnomei
  • Repository
  • 0 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Kirby HTMLHead

Kirby 5 PHP 8.2 Release Downloads Coverage Maintainability Discord Buymecoffee, (*1)

Kirby Plugin for a best-practice HTML Head Element extendable with snippets., (*2)

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 or
  • composer 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., (*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>

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., (*5)

License

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)

The Versions

28/07 2018

dev-master

9999999-dev

Kirby 3 Plugin for a best-practice HTML Head Element extendable with snippets.

  Sources   Download

MIT

The Requires

  • getkirby/cms dev-master as 3.0.0

 

by Bruno Meilick

28/07 2018

1.5.4

1.5.4.0

Kirby 3 Plugin for a best-practice HTML Head Element extendable with snippets.

  Sources   Download

MIT

The Requires

  • getkirby/cms dev-master as 3.0.0

 

by Bruno Meilick

27/07 2018

1.5.2

1.5.2.0

Kirby 3 Plugin for a best-practice HTML Head Element extendable with snippets.

  Sources   Download

MIT

The Requires

  • getkirby/cms 3.0.*

 

by Bruno Meilick

25/07 2018

1.5.1

1.5.1.0

Kirby 3 Plugin for a best-practice HTML Head Element extendable with snippets.

  Sources   Download

MIT

The Requires

  • getkirby/cms 3.0.*

 

by Bruno Meilick