When managing your website’s appearance in search results, controlling what content Google displays in snippets is crucial for your SEO strategy. The data-nosnippet attribute is a powerful tool that tells Google not to include specific content in search snippets, giving you greater control over your search appearance. This guide will show you how to implement this attribute correctly in Elementor, WordPress’s popular page builder.
What is data-nosnippet?
The data-nosnippet attribute is an HTML element that instructs Google not to include the marked content in search result snippets. According to Google’s documentation:
This content will not appear in search snippets
This attribute works regardless of any value assigned to it, and can be applied to <div>, <span>, and <section> elements.
Why Use data-nosnippet with Elementor?
There are several scenarios where you might want to prevent certain content from appearing in search snippets:
- Protect sensitive information
- Prevent duplicate content issues
- Control which parts of your page represent your content in SERPs
- Hide promotional content from search snippets
- Ensure your most important content appears in snippets instead of sidebars or navigation
Step-by-Step Implementation in Elementor
Method 1: Using Custom Attributes in Elementor
- Edit your Elementor widget (Post listing, text editor, etc.)
- Navigate to Advanced tab
- Expand the Attributes section
- In the Custom Attributes field, enter:
data-nosnippet|true- The pipe symbol (|) separates the attribute name from its value
- Any value works as Google ignores all values for this attribute
Method 2: Using HTML Code Directly
If you’re using an HTML widget in Elementor:
Content you don't want to appear in search snippets
Method 3: Via Custom Code Snippet
For developers who want to apply this attribute programmatically:
add_action('elementor/frontend/widget/before_render', function($widget) {
if($widget->get_name() === 'posts') {
$widget->add_render_attribute('_wrapper', 'data-nosnippet', 'true');
}
});
This code would apply the attribute to all Post widgets in your Elementor site.
Verifying Your Implementation
After adding the attribute, verify it’s working correctly:
- Inspect the HTML using browser developer tools
- Check that the attribute appears as data-nosnippet=”true” (or any value)
- Test with Google’s Rich Results Test: https://search.google.com/test/rich-results
- Monitor search results after Google reindexes your page
Common Mistakes to Avoid
- Incorrect syntax: Make sure to use the pipe symbol (|) when entering custom attributes
- Applying to wrong elements: Only <div>, <span>, and <section> tags support this attribute
- Unclosed tags: An unclosed tag with data-nosnippet will cause all following content to be excluded
- Overuse: Don’t hide too much content or you might harm your SEO
Google’s Guidelines for data-nosnippet
According to Google’s documentation:
- All values assigned to data-nosnippet are ignored
- It works on div, span, and section elements only
- Unclosed elements will affect all content that follows
- The attribute can be used with or without a value
Conclusion
The data-nosnippet attribute gives you precise control over how your content appears in Google search results. By implementing it correctly in Elementor using custom attributes, you can ensure that only your most relevant and compelling content appears in search snippets, potentially improving click-through rates and overall search performance.
Remember that changes may take time to be reflected in search results as Google needs to reindex your pages. Monitor your search appearance regularly and adjust your strategy as needed for optimal results.
FAQs
Q: Will data-nosnippet affect my SEO rankings? A: No, it only controls what appears in search snippets, not how your page ranks.
Q: Does data-nosnippet work with other search engines? A: While primarily designed for Google, some other search engines may respect this attribute.
Q: Can I apply data-nosnippet to an entire section in Elementor? A: Yes, you can add it to section settings under the Advanced tab.
Q: How long before Google respects my data-nosnippet settings? A: It depends on when Google recrawls your site, which can take days to weeks.
Q: Will data-nosnippet hide content from being indexed? A: No, the content is still indexed and contributes to rankings; it just won’t appear in snippets.





