SEO Time
This commit is contained in:
@@ -5,8 +5,11 @@ namespace App\Http\Controllers;
|
||||
use App\Helpers\EntryHelpers;
|
||||
use App\Models\Entry;
|
||||
use App\Models\News;
|
||||
use Artesaos\SEOTools\Facades\SEOTools;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class EntryController extends Controller
|
||||
@@ -16,6 +19,7 @@ class EntryController extends Controller
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
SEOTools::setTitle('Database');
|
||||
return view('entries.index');
|
||||
}
|
||||
|
||||
@@ -26,6 +30,7 @@ class EntryController extends Controller
|
||||
|
||||
public function show(string $section, Entry $entry): View
|
||||
{
|
||||
|
||||
if (!in_array($section, self::SECTION_TYPES))
|
||||
abort(404);
|
||||
|
||||
@@ -52,6 +57,13 @@ class EntryController extends Controller
|
||||
$comments = EntryHelpers::getLatestComments($entry);
|
||||
$reviews = $entry->reviews()->orderBy('created_at', 'desc')->limit(10)->get();
|
||||
|
||||
SEOTools::setTitle($entry->complete_title ?? $entry->title);
|
||||
SEOTools::setDescription( Str::limit( $entry->description, 150) );
|
||||
SEOTools::opengraph()->addProperty('type', 'article');
|
||||
if( $entry->main_image ){
|
||||
SEOTools::opengraph()->addImage( url( Storage::url( $entry->main_image ) ) );
|
||||
}
|
||||
|
||||
return view('entries.show', compact('entry', 'section', 'comments', 'reviews'));
|
||||
|
||||
}
|
||||
@@ -69,6 +81,7 @@ class EntryController extends Controller
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate(20);
|
||||
|
||||
SEOTools::setTitle('My Drafts');
|
||||
return view('entries.drafts', compact('drafts', 'newsDrafts'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user