Search code examples
phplaravellaravel-5laravel-bladepage-title

Laravel 5.1 - icon in the page title


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


Solution

  • 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>