In this article which was extracted from the video, I'll be discussing a new feature we've introduced in Varbase Media: the smart [node] token. This token is designed to intelligently select the most appropriate image to use when sharing nodes on social media platforms like Facebook, Twitter, or even Slack. Additionally, it comes with a fallback URL option, ensuring that even when no suitable images are found, a default image will be used. This feature simplifies the process and improves the appearance of shared content across platforms.
The Problem with the Old Approach
Previously, when we shared content, we relied on various tokens like old tokens that were too complicated to use by Editors or Content Admin.
The logic of nesting is not allowing us to have a fullback in the right way.
[node:field_media:entity:social_large]
[node:field_media:entity:social_medium]
[node:field_media:entity:social_small]
To specify which image should be used. These tokens required careful configuration and could become quite complex, especially when dealing with different content types and media fields.
For instance, if a content type had a field for media, and that media had a cover image, it would use that image. However, if no image was present in the media field, the token would fail to provide a share image, resulting in an incomplete or less appealing social media post.
The New Smart [node:share-image] Token
The new smart [node] token revolutionizes this process by automatically selecting the most suitable image based on the content of the node. Here's how it works:
- Field Media Check: If the content type includes a field media with an image or video, the token will use that image.
- Fallback to Field Image: If no field media is present, it checks for a field image.
- Field Video as a Last Resort: If neither of the above is found, it will check for a field video.
- Default Fallback Image: If none of these fields contain an image, the token will automatically use a pre-specified fallback image. This fallback image can be set globally in the default theme, ensuring a consistent look for all shared content.
Example Use Cases
Let’s break down some specific examples:
- Blog Posts with Media: Suppose you have a blog post content type that includes a field media. If the field media contains an image, this image will be used for sharing. If it contains a video, the cover image of the video will be used.
- Posts with Only Text: For a post that only contains text and no media, the token will default to using the fallback image, ensuring that the post is still visually engaging when shared.
- Content Types with Multiple Media Fields: In cases where a content type like “Show” includes both field media and field video, the token will prioritize field media. If no media is found, it will check the field video for a cover image. If neither is present, it falls back to the default image.
Automatic Functionality Out of the Box
One of the best aspects of the smart [node] token is that it works out of the box. As soon as the token is added to your meta tag configuration, it will begin to automatically select the best images for your content. This makes it incredibly easy to ensure that your content always looks its best when shared, without the need for extensive manual configuration.
Conclusion
The introduction of the smart [node] token in Varbase Media is a significant improvement over previous methods. By automating the selection of the best possible image for social sharing and providing a fallback option, it enhances both the user experience and the appearance of shared content. Whether you're a site admin or a content creator, this token will save you time and ensure your content is always share-ready.
Thank you for reading, and make sure to take advantage of this smart token in projects!