Update
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\MemeMedia;
|
||||
use Artesaos\SEOTools\Facades\SEOMeta;
|
||||
use Artesaos\SEOTools\Facades\OpenGraph;
|
||||
use Artesaos\SEOTools\Facades\TwitterCard;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
@@ -41,6 +44,47 @@ private function getMemes(?string $search = null): Response
|
||||
|
||||
$memes = $query->cursorPaginate(24);
|
||||
|
||||
// Set up SEO meta tags
|
||||
$title = $search ? ucfirst($search) . " Memes in MEMEFA.ST" : 'Meme Library - Thousands of Video Meme Templates';
|
||||
|
||||
if ($search) {
|
||||
// Get SEO descriptions from config
|
||||
$descriptions = config('platform.seo_descriptions.search_descriptions', []);
|
||||
|
||||
// Use deterministic selection based on search term hash
|
||||
$searchHash = crc32($search);
|
||||
$descriptionIndex = abs($searchHash) % count($descriptions);
|
||||
$descriptionTemplate = $descriptions[$descriptionIndex];
|
||||
|
||||
// Replace keyword placeholder
|
||||
$description = str_replace('__KEYWORD__', $search, $descriptionTemplate);
|
||||
} else {
|
||||
$description = 'Browse thousands of video meme templates ready for TikTok, Instagram Reels, Threads and YouTube Shorts. Create viral content in minutes with our meme editor.';
|
||||
}
|
||||
|
||||
SEOMeta::setTitle($title, false);
|
||||
SEOMeta::setDescription($description);
|
||||
SEOMeta::setCanonical(request()->url());
|
||||
|
||||
// Add pagination rel links
|
||||
if ($memes->previousPageUrl()) {
|
||||
SEOMeta::addMeta('link:prev', $memes->previousPageUrl(), 'rel');
|
||||
}
|
||||
if ($memes->nextPageUrl()) {
|
||||
SEOMeta::addMeta('link:next', $memes->nextPageUrl(), 'rel');
|
||||
}
|
||||
|
||||
// OpenGraph tags
|
||||
OpenGraph::setTitle($title);
|
||||
OpenGraph::setDescription($description);
|
||||
OpenGraph::setUrl(request()->url());
|
||||
OpenGraph::addProperty('type', 'website');
|
||||
|
||||
// Twitter Card
|
||||
TwitterCard::setTitle($title);
|
||||
TwitterCard::setDescription($description);
|
||||
TwitterCard::setType('summary_large_image');
|
||||
|
||||
// Get available types for filter
|
||||
$types = MemeMedia::where('is_enabled', true)
|
||||
->distinct()
|
||||
@@ -65,6 +109,7 @@ private function getMemes(?string $search = null): Response
|
||||
'filters' => [
|
||||
'search' => $search,
|
||||
],
|
||||
'dynamicDescription' => $search ? $description : null,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -104,7 +149,29 @@ public function show(string $slug): Response
|
||||
$relatedMemes = $relatedMemes->merge($randomMemes);
|
||||
}
|
||||
|
||||
//dd($meme);
|
||||
// Set up SEO meta tags for individual meme page
|
||||
$title = "{$meme->name} - Make Video Memes with MEMEFA.ST";
|
||||
$description = $meme->description
|
||||
? "This meme is about: {$meme->description}."
|
||||
: "Create {$meme->name} video memes with our online editor. Perfect for TikTok, Instagram Reels, and YouTube Shorts.";
|
||||
|
||||
SEOMeta::setTitle($title, false);
|
||||
SEOMeta::setDescription($description);
|
||||
SEOMeta::setCanonical(request()->url());
|
||||
SEOMeta::addKeyword(collect([$meme->keywords, $meme->action_keywords, $meme->emotion_keywords, $meme->misc_keywords])->flatten()->filter()->implode(', '));
|
||||
|
||||
// OpenGraph tags
|
||||
OpenGraph::setTitle($title);
|
||||
OpenGraph::setDescription($description);
|
||||
OpenGraph::setUrl(request()->url());
|
||||
//OpenGraph::addProperty('type', 'video.other');
|
||||
//OpenGraph::addImage($meme->webp_url);
|
||||
|
||||
// Twitter Card
|
||||
TwitterCard::setTitle($title);
|
||||
TwitterCard::setDescription($description);
|
||||
//TwitterCard::setType('summary_large_image');
|
||||
//TwitterCard::setImage($meme->webp_url);
|
||||
|
||||
return Inertia::render('memes/show', [
|
||||
'meme' => $meme,
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Artesaos\SEOTools\Facades\SEOMeta;
|
||||
use Artesaos\SEOTools\Facades\OpenGraph;
|
||||
use Artesaos\SEOTools\Facades\TwitterCard;
|
||||
use Illuminate\Support\Str;
|
||||
use Inertia\Inertia;
|
||||
|
||||
@@ -9,6 +12,25 @@ class FrontPagesController extends Controller
|
||||
{
|
||||
public function privacy()
|
||||
{
|
||||
// Set up SEO meta tags
|
||||
$title = 'Privacy Policy';
|
||||
$description = 'Read our privacy policy to understand how Memefast collects, uses, and protects your personal information when using our video meme creation platform.';
|
||||
|
||||
SEOMeta::setTitle($title);
|
||||
SEOMeta::setDescription($description);
|
||||
SEOMeta::setCanonical(request()->url());
|
||||
|
||||
// OpenGraph tags
|
||||
OpenGraph::setTitle($title);
|
||||
OpenGraph::setDescription($description);
|
||||
OpenGraph::setUrl(request()->url());
|
||||
OpenGraph::addProperty('type', 'website');
|
||||
|
||||
// Twitter Card
|
||||
TwitterCard::setTitle($title);
|
||||
TwitterCard::setDescription($description);
|
||||
TwitterCard::setType('summary');
|
||||
|
||||
$markdownPath = resource_path('markdown/privacy.md');
|
||||
$markdownContent = file_get_contents($markdownPath);
|
||||
|
||||
@@ -26,6 +48,25 @@ public function privacy()
|
||||
|
||||
public function terms()
|
||||
{
|
||||
// Set up SEO meta tags
|
||||
$title = 'Terms & Conditions';
|
||||
$description = 'Review our terms and conditions to understand the rules and guidelines for using Memefast video meme creation platform and services.';
|
||||
|
||||
SEOMeta::setTitle($title);
|
||||
SEOMeta::setDescription($description);
|
||||
SEOMeta::setCanonical(request()->url());
|
||||
|
||||
// OpenGraph tags
|
||||
OpenGraph::setTitle($title);
|
||||
OpenGraph::setDescription($description);
|
||||
OpenGraph::setUrl(request()->url());
|
||||
OpenGraph::addProperty('type', 'website');
|
||||
|
||||
// Twitter Card
|
||||
TwitterCard::setTitle($title);
|
||||
TwitterCard::setDescription($description);
|
||||
TwitterCard::setType('summary');
|
||||
|
||||
$markdownPath = resource_path('markdown/terms.md');
|
||||
$markdownContent = file_get_contents($markdownPath);
|
||||
|
||||
@@ -41,6 +82,42 @@ public function terms()
|
||||
]);
|
||||
}
|
||||
|
||||
public function dmcaCopyright()
|
||||
{
|
||||
// Set up SEO meta tags
|
||||
$title = 'DMCA Copyright Policy';
|
||||
$description = 'MEMEFA.ST DMCA copyright policy and procedures for reporting copyright infringement. Learn how to file DMCA notices and counter-notices.';
|
||||
|
||||
SEOMeta::setTitle($title);
|
||||
SEOMeta::setDescription($description);
|
||||
SEOMeta::setCanonical(request()->url());
|
||||
|
||||
// OpenGraph tags
|
||||
OpenGraph::setTitle($title);
|
||||
OpenGraph::setDescription($description);
|
||||
OpenGraph::setUrl(request()->url());
|
||||
OpenGraph::addProperty('type', 'website');
|
||||
|
||||
// Twitter Card
|
||||
TwitterCard::setTitle($title);
|
||||
TwitterCard::setDescription($description);
|
||||
TwitterCard::setType('summary');
|
||||
|
||||
$markdownPath = resource_path('markdown/dmca-copyright.md');
|
||||
$markdownContent = file_get_contents($markdownPath);
|
||||
|
||||
// Parse markdown to HTML using Laravel's built-in Str::markdown helper
|
||||
$htmlContent = Str::markdown($markdownContent);
|
||||
|
||||
// Style the HTML with Tailwind classes
|
||||
$styledContent = $this->styleHtmlContent($htmlContent);
|
||||
|
||||
return Inertia::render('FrontPages/DmcaCopyright', [
|
||||
'content' => $styledContent,
|
||||
'title' => 'DMCA Copyright Policy',
|
||||
]);
|
||||
}
|
||||
|
||||
private function styleHtmlContent($html)
|
||||
{
|
||||
// Add classes to various HTML elements using string replacement for Tailwind 4
|
||||
|
||||
Reference in New Issue
Block a user