Laravel 5.1 - 页面标题中的图标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33408699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel 5.1 - icon in the page title
提问by d.bikov
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>
<title>
<link rel="icon" href="{!! asset('images/gcm_ico.ico') !!}"/>@yield('page-title')
</title>
But it gets escaped in all browsers as shown 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
有没有人成功地做到了这一点?提前致谢
回答by Andrius
You should add the favicon to the <head></head>
part of the HTML document but not in the <title>
itself.
您应该将网站图标添加到<head></head>
HTML 文档的一部分,而不是在其<title>
本身中。
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.
即使 Favicon 出现在浏览器中,它也不是真正的标题的一部分。您可以在此处查看有关网站图标的更多信息。
The result should look like this:
结果应如下所示:
<html>
<head>
...
<title>@yield('page-title')</title>
<link rel="icon" href="{!! asset('images/gcm_ico.ico') !!}"/>
...
</head>
...
</html>