insight-media/seotamic 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

insight-media/seotamic

Composer 安装命令:

composer require insight-media/seotamic

包简介

Simple SEO addon for Statamic v3

README 文档

README

Statmic v3 only. Automatically adds a SEO tab to all your collection entries where you can fine tune SEO for every entry.

{{ seotamic }}

Generates the whole array of SEO settings:

<title>My Page Title</title>
<meta name="description" content="SEO friendly description" />
<link rel="canonical" href="https://mysite.com/page" />
<meta property="og:url" content="https://mysite.com/page" />
<meta property="og:site_name" content="Site name" />
<meta property="og:title" content="My Page Title" />
<meta property="og:description" content="SEO friendly description" />
<meta property="og:locale" content="en_US" />
<meta property="og:image" content="https://mysite.com/img/og.jpg" />
...

Version 2 changes

Version 2 has breaking changes. If you update from version 1, your global settings will not be transfered, you need to manually copy the old files to the content directory.

Installation

Include the package with composer:

composer require cnj/seotamic

The package requires Laravel 7+ and PHP 7.3+. It will auto register.

The SEO section tab will appear on all collection entries automatically.

Configuration (optional)

You can override the default options by publishing the configuration:

php artisan vendor:publish --provider="Cnj\Seotamic\ServiceProvider" --tag=config

This will copy the default config file to `config/seotamic.php'.

If you need to change the default assets container, make sure to apply the change in the Blueprints as well.

Usage

Usage is fairly simple and straight forward. You can visit the global Settings by following the Seotamic link on the navigation in the CP. Make sure to follow the instructions on each field.

After this you can fine tune the output of each collection entry by editing the SEO settings under the entry's SEO tab.

Antlers

There are several antler tags available, the easiest is to just include the do everything base tag in the head of your layout:

{{ seotamic }}

If you need more control you can manually get each part of the output by using:

{{ seotamic:title }}
{{ seotamic:description }}
{{ seotamic:canonical }}

This will return strings, so you need to wrap them in the appropriate tags, ie:

<title>{{ seotamic:title }}</title>

Social ones will still return everything with tags

{{ seotamic:og }}
{{ seotamic:twitter }}

Dynamic OG Image

In projects where you want the OG Image to be dynamic, for now you can use this ViewModel and inject it to your collection in order to dynamically assign the OG Image.

<?php

namespace App\ViewModels;

use Statamic\View\ViewModel;

class OgImage extends ViewModel
{
    public function data(): array
    {
        $image = $this->cascade->get('image');

        if ($image) {
            return [
                'seotamic_image' => $image
            ];
        }

        return [];
    }
}

In the example above we are assuming in your collection you have an image field which you can change to suit your usecase. Then in your collections you just have to inject the ViewModel.

title: Posts
inject:
  view_model: App\ViewModels\OgImage

Credits

This package was built by CNJ Digital.

License

This project is licensed under the MIT License.

insight-media/seotamic 适用场景与选型建议

insight-media/seotamic 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 211 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 insight-media/seotamic 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 insight-media/seotamic 我们能提供哪些服务?
定制开发 / 二次开发

基于 insight-media/seotamic 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 211
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-28