PHPackages                             omz13/kirby3-honehome - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. omz13/kirby3-honehome

AbandonedArchivedKirby-plugin[Utility &amp; Helpers](/categories/utility)

omz13/kirby3-honehome
=====================

kirby3 plugin to handle homepage redirection

1.1.3(7y ago)6611[1 issues](https://github.com/omz13/kirby3-honehome/issues)proprietaryPHPPHP &gt;=7.1

Since Jan 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/omz13/kirby3-honehome)[ Packagist](https://packagist.org/packages/omz13/kirby3-honehome)[ RSS](/packages/omz13-kirby3-honehome/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (9)Versions (7)Used By (0)

Kirby3 HoneHome
===============

[](#kirby3-honehome)

Coffee, Beer, etc.
------------------

[](#coffee-beer-etc)

This plugin was developed because I had an itch that needed scratching. I wanted a multi-language site to switch to the best-matching language indicated by a client's `Accept-Language` instead of the default one set in the site. The code was nastier to do than I thought, it had some evil edge cases, and after being refactored became something quite elegant. That the format for languages in HTML and HTTP are subtly different was just what I needed make developing this more difficult than it should be (and if you look at the code, that is why there are tortuous substitutions between hyphens and underscores all over the place). The `utf8` suffix was similarly a thing to work around.

A bit of trivia. When I started to work on this plugin, it was called *HomeHome* (because it made the home page twice as nice). And then one day I did a typo and called it *HoneHome*. But "hone" is a nice work because the plugin really "hones" the homepage. So it became *HoneHome*.

This plugin is free but if you use it in a commercial project to show your support you are welcome to:

- [make a donation 🍻](https://www.paypal.me/omz13/10) or
- [buy me ☕☕☕](https://buymeacoff.ee/omz13) or
- [buy a Kirby license using this affiliate link](https://a.paddle.com/v2/click/1129/36191?link=1170)

Documentation
-------------

[](#documentation)

### Purpose

[](#purpose)

For a kirby3 site, this plugin [omz13/honehome](https://github.com/omz13/kirby3-honehome) does magical things to a site's homepage.

When would you use this plugin?

- You are running a multi-language site and you want:
    - the homepage (default or replaced) to *automagically* switch to the language set by a browser's `Accept-Language` header (instead of defaulting to the site's default language). This is seriously cool.
    - pages to have the correct `lang` attribute (because it contains a helper function to do that what has to be done).
- You want to replace the homepage with a different page (e.g. for a blog-based site you would set this to the parent page for the blog posts).

The functional specification:

- In a multi-language installation, the homepage returns the localized homepage based on the best-match against a client's `Accept-Langauge` request.
- Provides a page method (`honehomeLang`) to set the HTML `lang` attribute (which for multi-language installations is a very good thing to do).
- A site's homepage can be set to a page specified from either a configuration file (`site/content/content.php`) or a panel content field (`content/site.txt` via `site/blueprints/site.yml`).

#### Roadmap

[](#roadmap)

The non-binding list of planned features and implementation notes are:

- MVP
- debug headers only in debug mode
- stan to level 7

### Installation

[](#installation)

Pick one of the following per your epistemological model:

- `composer require omz13/kirby3-honehome`; the plugin will automagically appear in `site/plugins`.
- Download a zip of the latest release - [master.zip](https://github.com/omz13/kirby3-honehome/archive/master.zip) - and copy the contents to your `site/plugins/kirby3-honehome`.
- `git submodule add https://github.com/omz13/kirby3-honehome.git site/plugins/kirby3-honehome`.

### Configuration

[](#configuration)

The following mechanisms can be used to modify the plugin's behavior and your kirby site.

#### site/snippets/header.php

[](#sitesnippetsheaderphp)

If you are running kirby as a multi-language system, for the multi-language to work nicely, you needed pages to indicate what language they are in. This plugin contains a page method - `honehomeLang( string $default = 'en' ) : string` - to return the locale in the correct format for use as an `` elements `lang` attribute.

TL;DR: change your `site/snippets/header.php` so the opening `` sets the `lang` attribute:

```
