How to use my Strapi plugin for SEO optimization of images
Posted on April 11, 2024 - by Andy Cinquin
SEOStrapi pluginImage optimizationReferencingOnline visibilitySearch enginesOptimized contentAutomatic generation of alternative textsAuto alt, caption, title on image
How to use my Strapi plugin, ALT, Title, Caption auto-generation on images from a Strapi API!
Hello everyone, in this article we're going to take a look at the plugin I've developed to automate image naming, the addition of alternative text and captions.
It's a Strapi plugin I developed myself after needing to optimize the SEO of my portfolio. Indeed, image alt text is important for SEO purposes. It was therefore necessary to have, for accessibility and SEO purposes, consistent names and alt tags for each of my images.
Problem: I had nearly a thousand images uploaded to my portfolio...
How to solve the problem? Adapt the scripts I'd made for the Obsidian plugin I'd developed over the same period of time.
So, let's see how to install and use my library!
We install the :
yarn add strapi-plugin-auto-alt-caption-title-on-images-ai-enhanced
Then activate the plugin
(config/plugin.js
), adding the following lines to the plugin list:module.exports = { // ... 'auto-alt-caption-title-on-images-ai-enhanced': { enabled: true, }, // ... }
We add our OpenAI key to the environment variables: (.env)
OPENAI_API_KEY=your-api-key
Rebuild our app & restart it
npm run build npm run develop or npm run build npm run start
- Then access the plugin in Strapi's administration panel by navigating to the "Auto Alt Caption Title on Images" section.
- The plugin will display a list of images in your Strapi Media Library that have no alt text, caption or name.
- To process a single image, click on the desired image. The plugin will initiate AI-driven image analysis and generate the alternative text, caption and name for that specific image.
- To process all images at once, click on the "Process All Images" button. The plugin will start analyzing and generating descriptions for all images in the list.
- While images are being processed, you can monitor progress via the progress bar and status messages.
- If necessary, you can cancel image processing by clicking on the "Cancel" button. This will stop processing the remaining images, but will not revoke any changes made to images already processed.
- Once image processing is complete, the generated alternative text, caption and name will be automatically saved for each image in the Strapi Media Library.
And that's it! Now you can stop worrying about renaming all your images! Fantastic, isn't it?
Thank you for your visit, feel free to contact me for
any information, quote or collaboration proposal. I will
be happy to answer you as soon as possible.
Did you like this article? Feel free to share it!