Laravel 5.1 - icon in the page title

d.bikov picture d.bikov · Oct 29, 2015 · Viewed 12.5k times · Source

I am struggling with adding an icon into the page title. So far I have tried adding it like this :

<title> <link rel="icon" href="{!! asset('images/gcm_ico.ico') !!}"/>@yield('page-title') </title>

But it gets escaped in all browsers as shown here :

enter image description here

I also tried printing the link with

{{ "<link rel='icon' hrer='".asset("images/gcm_ico.ico")."' />" }}.

Has anyone done this successfully? Thanks in advance

Answer

Andrius picture Andrius · Oct 29, 2015

You should add the favicon to the <head></head> part of the HTML document but not in the <title> itself.

Favicon is not really a part of title even if it appears so in the browser. You can check for more info on the favicon here.

The result should look like this:

<html>
<head>
...
<title>@yield('page-title')</title>
<link rel="icon" href="{!! asset('images/gcm_ico.ico') !!}"/>
...
</head>
...
</html>