Special characters in the title

How can I add special characters to the page-title?


From Russia with ♥


The above text should result in something like this;

But it does show like this;


When I manually enter ♥ it shows up allright - but when set through the panel, the error occurs.

I tried html entities, kirbytext(), text(), kt(), html()… but nothing did work.

The encoding is set like <meta charset="utf-8">

When I view source it looks good, 'though;

You can use html-signs like

&hearts;

&#x2665;

&#9829;

Good luck!

Unfortunately html entities don’t work when set by the panel;

I also tried the official codes &acirc; &trade; &yen; but it still shows up as code, not a symbol.

The symbol in the image above is hard-coded in the page, but I want to set it by the panel - using a blueprint…


To make things more clear;

this does work

<title>♥</title>


but this doesn’t

<title><?php echo $site->title()->text(); ?></title>

Try:

<title><?php echo $site->title()->html(); ?></title>

lol :stuck_out_tongue:

html() converts it to entities, which show up in the title.

It’s not a big deal, I was just wondering how to show a symbol in the title.

When I hardcode it in the html it works fine, when I “load” it through the panel it goes wrong.

:heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart: :heart:

Copy it from the first column at
SelfHTML: HTML/Zeichenreferenz, where it looks like “:heart:”!.

This works on my Kirby 2.3.2 with UTF-8.

1 Like

To make things more difficult, the title is not set direct - but later on by javascript.

I managed to solve it like this;


  • Entry in the panel (blueprint powered);

I miss you :heart:

  • Query in the template / php;

var title = "<?php echo $site->title()->text(); ?>";


So it must be entered hard-coded in the back-end and not converted to entities in the front-end.

Of course this only works when the encoding type is set correctly in the header.