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
♥
♥
♥
Good luck!
Unfortunately html entities
don’t work when set by the panel;
I also tried the official codes â ™ ¥
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>
Copy it from the first column at
SelfHTML: HTML/Zeichenreferenz, where it looks like “”!.
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
-
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.