Home > OS >  SEO - How to add noindex meta tag only in beta domain in laravel blade
SEO - How to add noindex meta tag only in beta domain in laravel blade

Time:11-15

I'm working on a laravel blade project and my site linked with 2 domains and I want to add noindex meta tag only on beta domain.

www.example.com don't add meta noindex tag

www.beta.example.com add meta noindex tag

Or I just need to add noindex meta tag and this will work automatically on beta domain and not work in actuall domain.

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

Thanks in advance

CodePudding user response:

A better solution is actually to use Request::getHost();

@if (str_contains(Request::getHost(),'beta'))
   <meta name="robots" content="noindex">
@endif
  • Related