PHPackages                             mxschll/laravel-meta-tags - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mxschll/laravel-meta-tags

AbandonedArchivedLibrary

mxschll/laravel-meta-tags
=========================

Better SEO for Laravel.

v1.1.0(5y ago)41.2kMITPHPPHP &gt;=7

Since Apr 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mxschll/laravel-meta-tags)[ Packagist](https://packagist.org/packages/mxschll/laravel-meta-tags)[ RSS](/packages/mxschll-laravel-meta-tags/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Laravel Meta Tags
=================

[](#laravel-meta-tags)

[![Build Status](https://camo.githubusercontent.com/a9c637e15f85ea5e7663ed1d6f88d38c1d1140511483d0f5df32aa225f5a70a3/68747470733a2f2f7472617669732d63692e6f72672f6d787363686c6c2f6c61726176656c2d6d6574612d746167732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mxschll/laravel-meta-tags)

This package allows you easily to manage HTML meta tags from your controllers, blade views or really everywhere else. It is super customizable and easy to configure.

---

Installation
------------

[](#installation)

Navigate to the root directory of your Laravel project and run the following command from your console:

```
composer require mxschll/laravel-meta-tags

```

The package will automatically register a service provider.

In order to configure your installation you need to publish the configuration file:

```
php artisan vendor:publish --provider="mxschll\MetaTags\MetaTagsServiceProvider"

```

You will find the configuration file at `src/config/meta-tags.php`.

First Step
----------

[](#first-step)

To get started, add the `@meta` Blade directive inside the `` tag of your page:

```

    Laravel
    @meta
    ....

```

Now all the standard tags are inserted into the page as set in the configuration file.

Usage in Blade Templates
------------------------

[](#usage-in-blade-templates)

### Add specific meta tags

[](#add-specific-meta-tags)

If you only want to add specific tags, you can do so by using the Blade directive `@meta_get()`:

```

    Laravel
    @meta_get('keywords')
    @meta_get('og:description')
    ....

```

### Set meta tag values

[](#set-meta-tag-values)

To set meta tags dynamically inside a Blade template, use `@meta_set()`:

```

    Laravel
    @meta_set({
    	"description": "This is a very nice description.",
    	"robots": "noindex"
	})
    @meta
    ....

```

This generates the following meta tags:

```
...

...
```

As you can see, the values of all description tags have changed. Of course, you can also set individual values for each tag by giving the exact tag names:

```

    Laravel
    @meta_set({
    	"description": "This is a very nice description.",
    	"twitter:description": "This is a twitter card description.",
    	"og:description": "This is an open graph description."
    	"robots": "noindex"
	})
    @meta
    ....

```

This generates the following meta tags:

```
...

...
```

Usage in Controllers
--------------------

[](#usage-in-controllers)

You can set meta tags anywhere in your Laravel application by using `\Meta::set($tag, $value)`:

```
