我正在開發一個 laravel blade 專案,我的網站與 2 個域相關聯,我只想在 beta 域上添加 noindex 元標記。
www.example.com不要添加 meta noindex 標簽
www.beta.example.com添加元 noindex 標簽
或者我只需要添加 noindex 元標記,這將自動在 beta 域上作業,而不在實際域中作業。
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<!--Here's the Meta noindex tag-->
<meta name="robots" content="noindex">
<script type='application/ld json'>
{
"@context": "http:\/\/schema.org",
"@type": "WebSite",
"@id": "#website",
"url": "{{ route('home') }}",
"name": "{{ config('app.name', 'Know Before You Go') }}",
"alternateName": "Know Before You Go"
}
</script>
@if(isset($seo))
{{ $seo }}
@else
<title>{{ __("seo.homepage.title") }}</title>
@endif
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Open Sans:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=PT Serif&display=swap" rel="stylesheet">
<!-- Styles -->
@vite('resources/css/app.css')
@livewireStyles
</head>
提前致謝
uj5u.com熱心網友回復:
更好的解決方案實際上是使用 Request::getHost();
@if (str_contains(Request::getHost(),'beta'))
<meta name="robots" content="noindex">
@endif
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/534847.html
標籤:拉维搜索引擎优化
上一篇:呼叫陣列的成員函式find()
