teamnovu / statamic-images-missing-alt

这是一个Statamic仪表盘的插件,用于列出所有没有alt文本的图片。

v1.0.4 2024-05-14 08:14 UTC

This package is auto-updated.

Last update: 2024-09-14 08:52:09 UTC


README

这是一个插件,用于列出您的Statamic仪表盘上所有没有alt文本的图片。

功能

此插件添加了一个小部件,您可以将其添加到仪表盘中。如果图片没有alt文本,它们将在这个小部件中列出。

在每个资产上添加alt文本可以提高可访问性和搜索引擎优化。

如何安装

您可以在Statamic仪表盘的“工具 > 插件”部分搜索此插件并点击“安装”,或者从项目的根目录运行以下命令

composer require teamnovu/statamic-images-missing-alt

如何使用

就像添加其他小部件一样,将小部件添加到您的 config/statamic/cp.php 中。

以下是一个示例,展示了您可以使用的所有可能的配置值。

'widgets' => [
    // ...

    [
        'type' => 'images_missing_alt', // Required
        'container' => 'assets', // Default: "assets" – The container to search through. Can also be an array to include multiple containers.
        'limit' => 5, // Default: 5 – The number of images to display in the widget.
        'width' => 50, // Default: 100 – The size of the widget.
    ],
],

注意 与Statamic Peak入门套件不同,此小部件永久缓存显示的资产,并在AssetDeleted、AssetSaved或AssetUploaded等事件触发时更新缓存。

致谢

此小部件基本上是从 Statamic Peak入门套件 中提取出来的。

有关在所有资产上添加alt文本的更严肃的解决方案,可在 此问题 中跟踪和讨论。