agenciafmd/laravel-social-meta

为那些不知道其用途的人提供的社交元信息

dev-master 2022-07-14 13:54 UTC

This package is auto-updated.

Last update: 2024-09-14 18:53:20 UTC


README

Downloads Licença

  • 为那些不知道其用途的人提供的社交元信息

安装

composer require agenciafmd/laravel-social-meta:dev-master

storage/social-meta上发布字体和背景

php artisan vendor:publish --tag=social-meta:assets

用法

在你的master.blade.php中(感谢Blade UI Kit

<x-social-meta
    title="{{ $__env->yieldContent('title', 'Culture Eats Strategy for Breakfast') }} | {{ config('app.name') }}"
    description="{{ $__env->yieldContent('description') }}"
/>

在其子元素上

@extends('agenciafmd/frontend::master')

@section('title', 'My custom title')
@section('description', 'My custom description')

输出

<title>My custom title | Laravel</title>

<meta name="twitter:card" content="summary_large_image" />

<meta property="og:type" content="website">
<meta property="og:title" content="My custom title | Laravel" />

<meta name="description" content="My custom description">
<meta property="og:description" content="My custom description">

<meta property="og:image" content="http://starternovo.local/storage/open-graph/facebook/my-custom-title-laravel.png" />
<meta property="og:url" content="http://starternovo.local" />
<meta property="og:locale" content="pt_BR" />
<meta property="og:site_name" content="Laravel"/>
<meta name="author" content="Agência F&MD">
 

OpenGraph 图像

OpenGraph Image

自定义

php artisan vendor:publish --tag=social-meta:config

调试

routes/web.php中放置

use Facades\Agenciafmd\SocialMeta\Services\OpenGraphImage;

Route::get('/asdf', function() {
    return OpenGraphImage::render();
});

许可协议

许可协议 MIT。 点击此处获取更多详情。