-4

I want different title, description and keywords on each and every product page and category page in my laravel website.

How can I make my website seo friendly to do this?

I am using laravel 5.7.

James Z
  • 12,209
  • 10
  • 24
  • 44
Robot
  • 76
  • 1
  • 9
  • What have you done yourself so far? (Add the appropriate meta tags with placeholders in your layout, fill the placeholders for every page you have) – brombeer Dec 27 '18 at 10:41
  • I am using this... @hasSection ('title')@yield('title') @else Title Here @endif – Robot Dec 27 '18 at 11:40

1 Answers1

1

In default.blade.php or master balde file you can create yield() and in blade file add section()

Example : app.blade.php

 @yield('meta')

in View blade file somefile.blade.php

@section('meta')
    ....
    <meta property="title" content="Place your data here">
    <meta property="keywords" content="Place your data here">
    ....
@endsection
Dhruv Raval
  • 1,535
  • 1
  • 8
  • 15
  • This is my code.... @hasSection ('title')@yield('title') @else Title Here @endif how i can make it easier, because same title is calling on every page... – Robot Dec 27 '18 at 11:41
  • ?? @sumit. means – Dhruv Raval Dec 27 '18 at 11:43
  • you tried this code ? – Dhruv Raval Dec 27 '18 at 11:45
  • I tried your code, but i need to add foreach loop..and this is not working on website default page...do u have any idea how it will work with default page... section('meta') foreach($propertysingle as $addmetas) endforeach endsection – Robot Dec 27 '18 at 11:58
  • `@section('meta') @foreach($propertysingle as $addmetas) @endforeach @endsection` – Robot Dec 27 '18 at 11:59
  • update your question with your code – Dhruv Raval Dec 27 '18 at 12:02
  • my question is this..if i am using `@yield('meta')` on my frontpage.blade.php (This page is replace by app.blade.php), then i am unable to find title,description, keywords on my website main page, but if i am using including this in internal page with something like this `@section('meta') @foreach($propertysingle as $addmetas) @endforeach @endsection` – Robot Dec 27 '18 at 12:27
  • then i can see title,description and keywords in my website, So now please let me know how i can see same thing on my website main index page. – Robot Dec 27 '18 at 12:27
  • your internal page (i assume internal pages are product display or other dynamic pages or blade ) extend `frontpage.blade.php` so you can use `@section('meta')` in internal page.And your home page is also extending `front.blade.php`. Suppose your home page is `index.blade.php`. you need to write meta in `index.blade.php` in `@section('meta')`. – Dhruv Raval Dec 27 '18 at 14:19
  • I have done the same things as you describe here, but the main issue is this when i am using `@section('meta') @endsection on internal pages, then i am getting 2 times title, description on internal pages. 1 title is coming from frontpage.blade.php (this file is using on every page @extends('layouts.frontpage')) file and another one is which i am adding on other blade file. – Robot Dec 28 '18 at 06:20
  • if you are setting meta in internal blade then why you are add meta in frontpage.blade.php – Dhruv Raval Dec 28 '18 at 06:22
  • remove from `frontpage.blade.php`. use `section('meta')` in all internal , dynamic and static page. – Dhruv Raval Dec 28 '18 at 06:24