Laravel 5.2-Metatag规范网址 [英] Laravel 5.2 - Metatag canonical Url

查看:54
本文介绍了Laravel 5.2-Metatag规范网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将元标记集成到我的布局Laravel中,

i'm tryng to integrate metatags in my layout laravel,

应用布局

<title>SiRegala.it - @yield('title')</title>
<meta name="description" content="@yield('description')"/>
<link rel="canonical" href="@yield('canonical')"/>

视图

@section('title')
Homepage
@stop
@section('canonical') 
<?php echoURL::current(); ?>
@stop

我正在尝试获取我的视图的当前URL,但实际上我收到此错误:

i'm tryng to get current url of my view, but actually i get this error:

找不到类'echoURL'

Class 'echoURL' not found

如何获取当前URL?也许有刀片?我试图用刀片搜索一些解决方案,但是我什么也没找到.

How can i get Current URL ? maybe with blade? i tryed to search some solution with blade but i did not find nothing.

谢谢您的帮助!

推荐答案

您忘记在echoURL门面之间放置空格:

You forgot to put space between echo and URL facade:

<?php echo URL::current(); ?>

此外,在Blade中,您通常希望避免使用<?php ?>:

Also, in Blade you usually want to avoid using <?php ?>:

{{ URL::current() }}

这篇关于Laravel 5.2-Metatag规范网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆