For some reason, I’ve recently noticed an increase in the number of website owners contacting me because search snippets are popping up that they’re not happy with. For example, Google selects text for a search snippet that it simply doesn’t want to appear in search results. The site owners didn’t know if they had any control over this or if they were just stuck.
In such situations, I always explain that providing a solid meta description can increase the chances of Google using your own description in the snippet. That is, and just like Google repeated this weekAny text on the page can be selected for the snippet. This can be the main content, user comments on the page, etc. The meta description or any content on the page can be used.
The good news for website owners is that there is a tool that allows you to limit what content is used to generate the snippet, and I find that many still don’t know it’s available. It’s called data-nosnippet and Google introduced this in 2019 (along with several other snippet controls). Data-nosnippet is easy to use and works well. And it can change your search snippets pretty quickly once the page is re-crawled and re-indexed.
Below I’ll walk you through a quick experiment I conducted to show how data-nosnippet works.
The test: Changing a search snippet via data-nosnippet.
To change your search snippet, you can use the data-nosnippet attribute on any div, span, or section HTML element. It’s just an attribute you can add to the HTML code. If the currently used content is not currently wrapped in a div, span, or section element that you can apply data-nosnippet to, you can add one that wraps the currently used content in the snippet (to tell Google NOT to do this ). use this text).
That’s pretty much it.
For the experiment, I first found a search snippet for one of my blog posts that wasn’t based on the meta description. Then I added a span tag in the HTML that contained the text used to create the search snippet.
I selected my post to review the x-robots tag because the snippet was not taken from the meta description and only focused on one of the tools in the post. The query was “Check Robots Tag”. Note that this was just to do a quick experiment and I’m not focusing on getting the perfect snippet for this result. I just wanted to explain how data-nosnippet works.
This is what the original snippet looked like on both desktop and mobile:
To modify the snippet, I added a Span HTML tag in WordPress that contained the text currently used by Google to create the search snippet. And then I added a data-nosnippet attribute to this span tag. And then I closed the span tag at the end of the text (like you would any HTML tag).
I added for example … Text content that I don’t want to use for the snippet.
Note that data-nosnippet is a boolean attribute, so you don’t need a value for the attribute. But WordPress added an empty value, so I changed it to true. However, keep in mind that Google doesn’t care what attribute it is. You could add data-snippet=”rankbrain” and it won’t matter. 🙂 As long as the data-nosnippet attribute is present, it should be used. I’ll explain a little more about this in the final tips section of this post.
Here is a screenshot from Google’s documentation on attribute values:
The results: Hello, new search snippet!
After adding data-nosnippet, I applied for indexing in GSC. It only took a few minutes and the post was re-crawled and re-indexed. But when I checked the search results, the snippet wasn’t changing that quickly… So I checked every hour or so to see when a new snippet would be generated. About 2.5 hours later, the snippet changed on both desktop and mobile. Success! The new snippet is not perfect, and I may continue working on it by applying data-nosnippet, but the attribute worked.
Here’s the new snippet for desktop and mobile:
How to use data-nosnippet: Tips and recommendations for website owners.
Below I provide some final tips and recommendations if you need to use data-nosnippet to modify a search snippet in Google search results. I think you’ll find that the attribute works as expected, is easy to use, and can take effect fairly quickly.
- You must use data-nosnippet on a div, span, or section HTML element. If you use it with another HTML element, it won’t work.
- As mentioned, data-nosnippet is a boolean attribute. This means it is enabled or disabled for the HTML element you are using it with. You not You must add a value for the attribute. However, it’s okay if you add one as Google will ignore any value there.
- Don’t forget to request indexing in GSC after implementing data-nosnippet. This would allow the URL to be re-crawled and re-indexed more quickly.
- Monitor changes in the SERPs after requesting indexing. Depending on what Google chooses for the snippet, you could actually end up with a worse search snippet! You can’t tell Google what text you want to use, so Google may choose different content that isn’t optimal. If you need to use data-nosnippet in additional areas of the content, you can do so.
- Data-nosnippet does NOT Impact indexing or ranking. It only affects what text can be used for the search snippet. So you can easily make the change, knowing that the content you tag with data-nosnippet can still be indexed and used for ranking purposes.
- From a rendering perspective, Google explains that it can extract data nosnippets both before and after rendering not Rely on JavaScript for this to work. Google recommends ensuring that data-nosnippet is included in the source HTML (static HTML).
Summary: Yes, you have some control over snippets.
If you find yourself in a situation where a search snippet doesn’t meet your needs or expectations, you have the option to change that snippet. This is exactly why Google introduced the data nosnippet in 2019. By adding a simple attribute to a div, span, or section HTML element, you can ensure that Google doesn’t use a specific part of your content to create a search snippet. It’s easy to do and can work fairly quickly. So don’t settle for suboptimal search snippets. You can implement changes in just a few minutes.
GG