When users create an article in the Particle Assembler that includes videos, a default thumbnail image appears when the video is uploaded to the Entry Editor. However, sometimes a video does not have a placeholder image or the image is something you want to change.
If the default image is not preferable, it is easy to change with custom CSS. Here is a step-by-step of how to do it.
First, find the image you would like to use as the video thumbnail. Then, use that image URL for the next steps. First, locate the post ID in the CSS. Using the Inspect function, you should find the post ID inside the tag <article>.
You can also easily find your Post ID In the URL of any RebelMouse article.
Now, using the specific post ID, you can change the background image for the <div> that contains code video you want t update. In the example below, the name 'no-image' is used to target the <div>.
In case there are many spots with the same name, you will need to use the CSS selector "first-of-type" or "first-child" to grab the specific occurrence you want to change.
Once you have found the specific element you want to change, apply the following rules:
/*set a thumbnail for one specific post*/ .post-2604691972 .listicle-slideshow__thumbnail > div.no-image { background-image: url('put the url created in the first step here'); }
Finally, remove the icon that is hovering your picture with the following rule:
.post-2604691972 .listicle-slideshow__thumbnail > div.no-image path { display: none; }
Once the custom CSS is updated, you should see your new image as a thumbnail option in the post.
How to Add a Placeholder Image for Articles on Google AMP
The process is similar if you are publishing on Google AMP, but you need to use custom AMP CSS through our Layout & Design tool to make sure you are grabbing the target element only. Here is where to find it:
For AMP, use the same image URL as the previous example. To find the AMP-specific CSS rule that will only grab the desired post and the <div> you need, inspect the article's code to find the right place.
Then, inside your post, find the element you want to change the background image. In the example below, the CSS selector "first-of-type" is used to isolate only the first occurrence of the carousel image:
/*set a thumbnail for one specific post*/ .css-listicle-body-2604691972 button.amp-carousel-slide.amp-scrollable-carousel-slide:first-of-type { background-image: url(https://media.fox16.com/nxsglobal/fox16/photo/2018/09/07/Interview_with_Mother_of_Botham_Jean_0_54547264_ver1.0_640_360.jpg); background-size: cover;
Finally, remove the default image in order to see your new background image. In order to do that, set the <img src> of target element to "none."
.css-listicle-body-2604691972 button.amp-carousel-slide.amp-scrollable-carousel-slide:first-of-type amp-img[src]{ display:none; }
Once completed, here is how the additional thumbnail will look on Google AMP:
If you have any questions about how this works, contact support@rebelmouse.com to help you anytime.
Related Articles