Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/code4mk/lara-head
Easily setup SEO in your laravel project with lara-head :heart: @code4mk
https://github.com/code4mk/lara-head
0devco code4mk head laravel laravel-meta laravel-seo php seo
Last synced: 4 days ago
JSON representation
Easily setup SEO in your laravel project with lara-head :heart: @code4mk
- Host: GitHub
- URL: https://github.com/code4mk/lara-head
- Owner: code4mk
- Created: 2019-04-27T20:58:16.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-09T17:07:01.000Z (about 5 years ago)
- Last Synced: 2025-01-21T13:06:04.766Z (11 days ago)
- Topics: 0devco, code4mk, head, laravel, laravel-meta, laravel-seo, php, seo
- Language: PHP
- Homepage: https://code4mk.org
- Size: 8.79 KB
- Stars: 177
- Watchers: 10
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# installation
```bash
composer require code4mk/lara-head
```# usage meta
~ inside controller
```php
use Khead;
class Test
{
public function home()
{
Khead::setMeta('viewport',[
"name" => "viewport",
"content"=>"width=device-width, initial-scale=1"
]);
}
}
```~ inside blade
```php
{{ Khead::getMeta('viewport') }}
//
```# link
```php
Khead::setLink('author',[
"rel"=>"author",
"href"=>"humans.txt"
]);
// blade
{{ Khead::getLink('author') }}
//
```# script
```php
Khead::setScript('one',[
"src"=>"test.js",
]);
// blade
{{ Khead::getScript('one') }}
//
```
# title```php
Khead::setTitle('this is a title');
// blade
{{ Khead::getTitle() }}
```# facebook open graph
```php
Khead::setOg([
"app_id" => [
"property"=>"fb:app_id",
"content"=>"123456789"
],
"url" => [
"property"=>"og:url",
"content"=>"https://example.com/page.html"
],
"type" => [
"property"=>"og:type", "content"=>"website"
],
"title" => [
"property"=>"og:title",
"content"=>"Content Title"
],
"image" => [
"property"=>"og:image",
"content"=>"https://example.com/image.jpg"
],
"description" => [
"property"=>"og:description",
"content"=>"Description Here"
],
"site_name" => [
"property"=>"og:site_name",
"content"=>"Site Name"
],
"locale" => [
"property"=>"og:locale",
"content"=>"en_US"
],
"author" => [
"property"=>"article:author",
"content"=>"@code4mk"
]
]);
// blade
{{ Khead::getOg() }}
```# twitter cards
```php
Khead::setTwitCards([
"card" => [
"name" => "twitter:card",
"content"=>"summary"
],
"site" => [
"name"=>"twitter:site",
"content"=>"@code4mk"
],
"creator" => [
"name"=>"twitter:creator",
"content"=>"@code4mk"
],
"url" => [
"name"=>"twitter:url",
"content"=>"https://code4mk.org"
],
"title" => [
"name"=>"twitter:title",
"content"=>"Content Title"
],
"description" => [
"name"=>"twitter:description",
"content"=>"Content description less than 200 characters"
],
"image" => [
"name"=>"twitter:image",
"content"=>"https://code4mk.org/image.jpg"
],
"dnt" => [
"name"=>"twitter:dnt",
"content"=>"on"
]
]);
// blade
{{ Khead::getTwitCards() }}
```# Head tags
* [gist link](https://gist.github.com/lancejpollard/1978404)
* [gethead](https://gethead.info/)