doucan957495 2015-10-29 07:56
浏览 238
已采纳

Laravel 5.1 - 页面标题中的图标

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

  • 写回答

1条回答 默认 最新

  • dongsuiying7773 2015-10-29 08:24
    关注

    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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?