✨ Ajoute le module SEO
Pour #8 Co-authored-by: Clement <clement@desmidt.fr> Reviewed-on: #12
This commit is contained in:
parent
1d136093c7
commit
5442bf19b0
@ -3,12 +3,27 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Home;
|
||||
use Artesaos\SEOTools\Traits\SEOTools as SEOToolsTrait;
|
||||
use DateTime;
|
||||
|
||||
class PublicController extends Controller
|
||||
{
|
||||
use SEOToolsTrait;
|
||||
|
||||
public function show($slug)
|
||||
{
|
||||
$home = Home::where('slug', $slug)->firstOrFail();
|
||||
$this->seo()
|
||||
->setTitle($home->title)
|
||||
->setDescription($home->excerpt())
|
||||
->addImages(array_map(static function($picture) {
|
||||
return asset($picture);
|
||||
}, $home->pictures));
|
||||
$this->seo()
|
||||
->opengraph()
|
||||
->addProperty('article:published_time', $home->created_at->format(DateTime::ATOM))
|
||||
->addProperty('article:author', 'Shikiryu');
|
||||
|
||||
return view('public.view', ['home' => $home]);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
"php": "^7.2.5",
|
||||
"ext-json": "*",
|
||||
"absmoca/leboncoin": "dev-master",
|
||||
"artesaos/seotools": "^0.18.0",
|
||||
"emanueleminotto/simple-html-dom": "^1.5",
|
||||
"fabpot/goutte": "^3.1",
|
||||
"fideloper/proxy": "^4.2",
|
||||
|
69
composer.lock
generated
69
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "71386ccf87ea9b8b3be2921f40baca69",
|
||||
"content-hash": "b1bb2469deb87a0a1452b8b376e64e1a",
|
||||
"packages": [
|
||||
{
|
||||
"name": "absmoca/leboncoin",
|
||||
@ -43,6 +43,73 @@
|
||||
"description": "SDK du plus célèbre site entre particuliers en France",
|
||||
"time": "2019-01-06T10:00:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "artesaos/seotools",
|
||||
"version": "v0.18.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/artesaos/seotools.git",
|
||||
"reference": "91c9fc3ee18db01d220dd47708f303b8eff8078b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/artesaos/seotools/zipball/91c9fc3ee18db01d220dd47708f303b8eff8078b",
|
||||
"reference": "91c9fc3ee18db01d220dd47708f303b8eff8078b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"illuminate/config": "5.8.* || ^6.0 || ^7.0",
|
||||
"illuminate/support": "5.8.* || ^6.0 || ^7.0",
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "~3.8.4 || ^4.0 || ^5.0",
|
||||
"phpspec/phpspec": "~5.1.1 || ^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Artesaos\\SEOTools\\Providers\\SEOToolsServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"SEOMeta": "Artesaos\\SEOTools\\Facades\\SEOMeta",
|
||||
"OpenGraph": "Artesaos\\SEOTools\\Facades\\OpenGraph",
|
||||
"Twitter": "Artesaos\\SEOTools\\Facades\\TwitterCard",
|
||||
"JsonLd": "Artesaos\\SEOTools\\Facades\\JsonLd",
|
||||
"SEO": "Artesaos\\SEOTools\\Facades\\SEOTools"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Artesaos\\SEOTools\\": "src/SEOTools/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Vinicius",
|
||||
"email": "luiz.vinicius73@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "SEO Tools for Laravel and Lumen",
|
||||
"keywords": [
|
||||
"JSON-LD",
|
||||
"laravel",
|
||||
"lumen",
|
||||
"metatags",
|
||||
"opengraph",
|
||||
"seo",
|
||||
"seotools",
|
||||
"webmaster"
|
||||
],
|
||||
"time": "2020-06-19T22:31:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
"version": "v2.0.1",
|
||||
|
@ -165,6 +165,7 @@ return [
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
Artesaos\SEOTools\Providers\SEOToolsServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
@ -220,6 +221,7 @@ return [
|
||||
'Response' => Illuminate\Support\Facades\Response::class,
|
||||
'Route' => Illuminate\Support\Facades\Route::class,
|
||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||
'SEO' => Artesaos\SEOTools\Facades\SEOTools::class,
|
||||
'Session' => Illuminate\Support\Facades\Session::class,
|
||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||
'Str' => Illuminate\Support\Str::class,
|
||||
|
68
config/seotools.php
Normal file
68
config/seotools.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* @see https://github.com/artesaos/seotools
|
||||
*/
|
||||
|
||||
return [
|
||||
'meta' => [
|
||||
/*
|
||||
* The default configurations to be used by the meta generator.
|
||||
*/
|
||||
'defaults' => [
|
||||
'title' => 'Le projet Bretagne', // set false to total remove
|
||||
'titleBefore' => false, // Put defaults.title before page title, like 'It's Over 9000! - Dashboard'
|
||||
'description' => false, // set false to total remove
|
||||
'separator' => ' - ',
|
||||
'keywords' => ['immobilier'],
|
||||
'canonical' => false, // Set null for using Url::current(), set false to total remove
|
||||
'robots' => false, // Set to 'all', 'none' or any combination of index/noindex and follow/nofollow
|
||||
],
|
||||
/*
|
||||
* Webmaster tags are always added.
|
||||
*/
|
||||
'webmaster_tags' => [
|
||||
'google' => null,
|
||||
'bing' => null,
|
||||
'alexa' => null,
|
||||
'pinterest' => null,
|
||||
'yandex' => null,
|
||||
'norton' => null,
|
||||
],
|
||||
|
||||
'add_notranslate_class' => false,
|
||||
],
|
||||
'opengraph' => [
|
||||
/*
|
||||
* The default configurations to be used by the opengraph generator.
|
||||
*/
|
||||
'defaults' => [
|
||||
'title' => 'Le projet Bretagne', // set false to total remove
|
||||
'description' => false,
|
||||
'url' => false, // Set null for using Url::current(), set false to total remove
|
||||
'type' => 'article',
|
||||
'site_name' => 'Le projet Bretagne',
|
||||
'images' => [],
|
||||
],
|
||||
],
|
||||
'twitter' => [
|
||||
/*
|
||||
* The default values to be used by the twitter cards generator.
|
||||
*/
|
||||
'defaults' => [
|
||||
'card' => 'summary',
|
||||
'site' => '@shikiryu',
|
||||
],
|
||||
],
|
||||
'json-ld' => [
|
||||
/*
|
||||
* The default configurations to be used by the json-ld generator.
|
||||
*/
|
||||
'defaults' => [
|
||||
'title' => 'Le projet Bretagne', // set false to total remove
|
||||
'description' => false, // set false to total remove
|
||||
'url' => false, // Set null for using Url::current(), set false to total remove
|
||||
'type' => 'WebPage',
|
||||
'images' => [],
|
||||
],
|
||||
],
|
||||
];
|
@ -4,6 +4,10 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
@if(Auth::guest())
|
||||
{!! SEO::generate() !!}
|
||||
@endif
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user