Finish SEO

This commit is contained in:
dev 2021-08-06 14:01:16 -07:00
parent d5a3175bea
commit 58fb2d2834
9 changed files with 159 additions and 12 deletions

View File

@ -4,11 +4,13 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use chillerlan\QRCode\{QRCode, QROptions}; use chillerlan\QRCode\{QRCode, QROptions};
use Artesaos\SEOTools\Facades\SEOTools;
class AboutController extends Controller class AboutController extends Controller
{ {
public function index() public function index()
{ {
SEOTools::setTitle('About');
$data = [ $data = [
'address' => config('app.xmr_tip_address'), 'address' => config('app.xmr_tip_address'),
'qr' => (new QRCode)->render(config('app.xmr_tip_address')), 'qr' => (new QRCode)->render(config('app.xmr_tip_address')),

View File

@ -4,11 +4,13 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Meme; use App\Models\Meme;
use Artesaos\SEOTools\Facades\SEOTools;
class ApiController extends Controller class ApiController extends Controller
{ {
public function documentation() public function documentation()
{ {
SEOTools::setTitle('API');
$data = [ $data = [
'memes_example' => json_encode(Meme::limit(1)->get(), JSON_PRETTY_PRINT), 'memes_example' => json_encode(Meme::limit(1)->get(), JSON_PRETTY_PRINT),
'memes_endpoint' => url('api/memes'), 'memes_endpoint' => url('api/memes'),

View File

@ -3,11 +3,13 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Artesaos\SEOTools\Facades\SEOTools;
class ContactController extends Controller class ContactController extends Controller
{ {
public function index() public function index()
{ {
SEOTools::setTitle('Contact');
$data = []; $data = [];
return view('contact', ['data' => $data]); return view('contact', ['data' => $data]);
} }

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Meme; use App\Models\Meme;
use Artesaos\SEOTools\Facades\SEOTools;
class DashboardController extends Controller class DashboardController extends Controller
{ {
@ -24,6 +25,7 @@ class DashboardController extends Controller
*/ */
public function index() public function index()
{ {
SEOTools::setTitle('Dashboard');
if (\Auth::user()->is_admin === 1) { if (\Auth::user()->is_admin === 1) {
$memes_pending = Meme::withoutGlobalScope('approved')->where('is_approved', 0)->get(); $memes_pending = Meme::withoutGlobalScope('approved')->where('is_approved', 0)->get();
} }

View File

@ -8,6 +8,7 @@ use App\Models\Address;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use chillerlan\QRCode\{QRCode, QROptions}; use chillerlan\QRCode\{QRCode, QROptions};
use MoneroIntegrations\MoneroPhp\walletRPC; use MoneroIntegrations\MoneroPhp\walletRPC;
use Artesaos\SEOTools\Facades\SEOTools;
class MemeController extends Controller class MemeController extends Controller
{ {
@ -29,12 +30,8 @@ class MemeController extends Controller
*/ */
public function index() public function index()
{ {
SEOTools::setTitle('Home');
$data = [ $data = [
'seo' => [
'title' => null,
'desc' => null,
'img' => null,
],
'memes' => Meme::with(['user', 'tips'])->orderByDesc('created_at')->paginate(20), 'memes' => Meme::with(['user', 'tips'])->orderByDesc('created_at')->paginate(20),
]; ];
return view('homepage', ['data' => $data]); return view('homepage', ['data' => $data]);
@ -42,6 +39,7 @@ class MemeController extends Controller
public function leaderboard() public function leaderboard()
{ {
SEOTools::setTitle('Leaderboard');
$users = User::with('tips')->has('memes')->get(); $users = User::with('tips')->has('memes')->get();
$users = $users->sortByDesc(function($user) { $users = $users->sortByDesc(function($user) {
return $user->tips_total; return $user->tips_total;
@ -61,6 +59,7 @@ class MemeController extends Controller
*/ */
public function create() public function create()
{ {
SEOTools::setTitle('Submit');
return view('meme-create'); return view('meme-create');
} }
@ -96,6 +95,9 @@ class MemeController extends Controller
{ {
$meme = Meme::where('id', $id)->with(['user', 'tips'])->firstOrFail(); $meme = Meme::where('id', $id)->with(['user', 'tips'])->firstOrFail();
SEOTools::setTitle($meme->title);
SEOTools::addImages($meme->image_url);
$share = \Share::page(url()->current(), $meme->title, ['class' => 'fa-lg', 'target' => '_blank']) $share = \Share::page(url()->current(), $meme->title, ['class' => 'fa-lg', 'target' => '_blank'])
->facebook() ->facebook()
->twitter() ->twitter()

View File

@ -6,6 +6,7 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^7.3|^8.0", "php": "^7.3|^8.0",
"artesaos/seotools": "^0.20.1",
"chillerlan/php-qrcode": "^4.3", "chillerlan/php-qrcode": "^4.3",
"fideloper/proxy": "^4.4", "fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0", "fruitcake/laravel-cors": "^2.0",

73
composer.lock generated
View File

@ -4,8 +4,79 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "d4b49b5d84d95faf47df7ada81dfc05e", "content-hash": "79607b3c728e5c08ba78d12cce54d7d1",
"packages": [ "packages": [
{
"name": "artesaos/seotools",
"version": "v0.20.1",
"source": {
"type": "git",
"url": "https://github.com/artesaos/seotools.git",
"reference": "7a2901eb3f5f6a8c70245d60568f0377eb5d3229"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/artesaos/seotools/zipball/7a2901eb3f5f6a8c70245d60568f0377eb5d3229",
"reference": "7a2901eb3f5f6a8c70245d60568f0377eb5d3229",
"shasum": ""
},
"require": {
"ext-json": "*",
"illuminate/config": "5.8.* || ^6.0 || ^7.0 || ^8.0",
"illuminate/support": "5.8.* || ^6.0 || ^7.0 || ^8.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"
],
"support": {
"issues": "https://github.com/artesaos/seotools/issues",
"source": "https://github.com/artesaos/seotools"
},
"time": "2021-05-03T21:46:46+00:00"
},
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
"version": "v2.0.3", "version": "v2.0.3",

68
config/seotools.php Normal file
View 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' => 'XmrMemes', // set false to total remove
'titleBefore' => false, // Put defaults.title before page title, like 'It's Over 9000! - Dashboard'
'description' => 'Get paid in Monero for making awesome memes about Monero (XMR).', // set false to total remove
'separator' => ' - ',
'keywords' => ['Monero', 'Xmr', 'memes'],
'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' => 'XmrMemes', // set false to total remove
'description' => 'Get paid in Monero for making awesome memes about Monero (XMR).', // set false to total remove
'url' => null, // Set null for using Url::current(), set false to total remove
'type' => false,
'site_name' => false,
'images' => [],
],
],
'twitter' => [
/*
* The default values to be used by the twitter cards generator.
*/
'defaults' => [
//'card' => 'summary',
//'site' => '@LuizVinicius73',
],
],
'json-ld' => [
/*
* The default configurations to be used by the json-ld generator.
*/
'defaults' => [
'title' => 'XmrMemes', // set false to total remove
'description' => 'Get paid in Monero for making awesome memes about Monero (XMR).', // set false to total remove
'url' => false, // Set null for using Url::current(), set false to total remove
'type' => 'WebPage',
'images' => [],
],
],
];

View File

@ -4,22 +4,19 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
{!! SEOMeta::generate() !!}
{!! OpenGraph::generate() !!}
{!! JsonLd::generate() !!}
<!-- CSRF Token --> <!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Scripts --> <!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script> <script src="{{ asset('js/app.js') }}" defer></script>
<!-- Styles --> <!-- Styles -->
@if (Session::get('theme')) @if (Session::get('theme'))
<link href="{{ url('') . mix('css/app_' . Session::get('theme') . '.css') }}" rel="stylesheet"> <link href="{{ url('') . mix('css/app_' . Session::get('theme') . '.css') }}" rel="stylesheet">
@else @else
<link href="{{ url('') . mix('css/app_light.css') }}" rel="stylesheet"> <link href="{{ url('') . mix('css/app_light.css') }}" rel="stylesheet">
@endif @endif
</head> </head>
<body> <body>