Social images generation
You need to manually enable this feature.
Peak can generate your social sharing images (OG and Twitter) and add them to your entries. To use this feature you need to install Browsershotopen in new window and its dependencies. A big thanks to Spatieopen in new window and Puppeteeropen in new window!
Installation and configuration
On your development machine you can do this by running the following commands:
composer require spatie/browsershot
npm install puppeteer --global
2
Once you've installed the required software you can enable the functionality in the SEO globals -> Social Sharing. Make sure to flick on the switch and select each collection for which you want to enable auto generated social images.
Publish the Peak SEO addon views:
php artisan vendor:publish --tag="statamic-peak-seo-views"
If you don't plan on making any other changes to the SEO integration you only have to keep resources/views/vendor/statamic-peak-seo/components/_social_image.antlers.html
and edit that file to determine how the images should look. You can go wild with Antlers and Tailwind CSS and add any field you'd like to use. If you want to preview the images in your browser visit http://yoursite.test/social-images/{id}
.
Custom node and npm binaries
You can locate your specific paths by running
which node
andwhich npm
in your terminal.
Depending on your setup, node or npm might be not directly available to Browsershot. If you need to manually set these binary paths, you can do this by setting SOCIAL_IMAGE_NODE_BINARY
and SOCIAL_IMAGE_NPM_BINARY
in your .env
file.
Redis as queue driver
You can set the queue name by defining
SOCIAL_IMAGE_QUEUE_NAME
in your.env
file.
The actual generation of the images is a job, so it's queued when you use Redis. Read more on how to properly configure Redis.
Generate the images
Once you've opted in the collections you want this available for you can select the entries you want to generate images for in the collection view.
Listable columns
Note that you could opt to toggle the Social image
and Twitter image
fields listable in the collections list view. That way you can or your client can easily scan collections for missing images.