Blog Detail

14

Sep
Improve SEO of your website with Laravel Meta Manager cover image

arrow_back Improve SEO of your website with Laravel Meta Manager

David Oti introduced a package called Laravel Meta Manager for Seo development. Laravel Meta Manager is an SEO tool that is used to improve the SEO of a website or specific page by adding recommended meta tags to your application.

These are the following features of this package.

  • Standard Meta Tags
  • Facebook OpenGraph Meta Tags
  • Twitter Card Meta Tags
  • Dublin Core Meta Tags
  • Link Tags

Installation

You have to run this command to install this package via composer.

composer require davmixcool/laravel-meta-manager

Laravel 5.5+ uses Package Auto-Discovery, so doesn’t require you to manually add the ServiceProvider.

After the installation, the next thing you have to do is insert the service provider within config/app.php.

'providers' => [
        Davmixcool\MetaManager\MetaServiceProvider::class,
];

After that you have to run this command to get the config of Laravel Meta Manager.

php artisan vendor:publish --provider="Davmixcool\MetaManager\MetaServiceProvider   

Configuration

You can set up the default application meta in the meta.php config file. (Optional but recommended)

Available options:

Option Description
robots Robots option tells search engines what to follow and what not to follow.
revisit_after Here you may specify how search engines will re-visit and re-crawl your site.
referrer Here you may specify how you want other sites to get referrer information from your site.
type Here you may specify the structure type of your website or a specific page
title Here you may provide the title of your website or a specific page to help search engines understand it better.
description Here you may provide the description of your website or a specific page to help search engines understand it better.
image Here you may provide the URL to the image you want search engines and crawlers to make use of when displaying your website or a specific page.
author Here you may provide the author’s name you want search engines to make use of when displaying your website or a specific page.
geo_region Here you specify the region of your location. This is useful if you have a physical location that is important for your business.
geo_position Here you specify the geo-coordinates of your physical location in longitude and latitude.
twitter_site Here you may provide your Twitter @username of your account
twitter_card Here you may specify the way you want crawlers to understand your Twitter share type.
fb_app_id Here you may provide your Facebook app id
keywords Here you may provide keywords relevant to your website and the specific page.

Usage

Once the configuration is complete you can then add the below code at the meta area of the page, where you want to add meta tags;

@include('meta::manager')

The above will use the predefined configurations to prefill the generated meta tags. However, if you chose to define certain options on the fly then you can use the code below.

@include('meta::manager', [
    'title'         => 'My Example Title',
    'description'   => 'This is my example description',
    'image'         => 'Url to the image',
])

For Example

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        @include('meta::manager', [
            'title'         => 'My Example Title',
            'description'   => 'This is my example description',
            'image'         => '',
        ])
    </head>
    <body>

    </body>
    </html>

You can learn more about this package on github.

Published at : 14-09-2021

Author : Rizwan Aslam
AUTHOR
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project