-
app/Providers/AppServiceProvider.php
Open in GitHubuse Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { public function boot() { Blade::directive('og', function ($expression) { list($property, $content) = explode(',', $expression, 2); return "<?php echo '<meta property=\"og:' . $property . '\" content=\"' . $content . '\">' . \"\n\"; ?>"; }); } // }
-
resources/views/packages/show.blade.php
Open in GitHub// @section('meta') @og('title', $package['name']) @og('type', 'object') @og('url', route('packages.show', ['namespace' => $package['packagist_namespace'], 'name' => $package['packagist_name']])) @og('image', $packageOgImageUrl) @og('description', e($package['abstract'])) @og('site_name', 'Nova Packages') <meta name="twitter:card" content="summary_large_image"> @endsection //