Hello Eveyone,
I am validating a html 5 page using w3c validator. However, this error occurred:
"Element noindex not allowed as child of element div in this context"
Can you please send some idea on how to resolve this?
Thanks.
Hello Eveyone,
I am validating a html 5 page using w3c validator. However, this error occurred:
"Element noindex not allowed as child of element div in this context"
Can you please send some idea on how to resolve this?
Thanks.
As correctly notes, the validator error comes from a nonstandard element: <noindex> is not part of the HTML5 spec and will be flagged by the W3C validator. Some engines (notably Yandex) recognize <noindex>, which is why some widget providers include it, but it is not a valid HTML5 element and will break validation.
Options that preserve validation while giving control over how search engines treat the widget:
<noindex> wrapper. This immediately fixes the validation error. <div class="share-widget" data-nosnippet>
<!-- provider script loader (no <noindex>) -->
</div> Note: data-nosnippet stops Google from showing that element in search-result snippets but does not prevent the page from being indexed.
<iframe src="/widgets/share-buttons.html" title="Share buttons" loading="lazy"></iframe> rel="nofollow" if preventing link equity is desired.Troubleshooting checklist: remove the <noindex> tags and re-run the validator; decide whether fragment-level control (use data-nosnippet) or document-level control (meta robots / X-Robots-Tag on an iframe) is required; test behavior in target search engines; and request an HTML5-compliant snippet from the widget vendor if the provider expects Yandex-style handling.
Jump to Post— pritaeas 2,276It would help if you show the relevant piece of HTML.
It would help if you show the relevant piece of HTML.
Thanks for the reply.
Its from the sharexy social media sharing tool:
<!--sharexy code start--><noindex><div id='shr_709264'><script type='text/javascript'>(function(w) { if (!w.SharexyWidget) { w.SharexyWidget = {};} if (!w.SharexyWidget.Params) { w.SharexyWidget.Params = {}; } w.SharexyWidget.Params['709264'] = {'code_id':'709264','publisher_key':'0','design':'classic','layout_static':'h','type':'st','mode_float':'','size_float':'60','size_static':'55','buzz':'0','services':['facebook', 'twitter'],'url':'current','allways_show_ads':'0','show_ads_sharing':'0','show_ads_cursor':'0','bg_float':'0','bg_color':'#f1f1f1','labels':'','counters':'r', 'counters_float':'0'} })(window);</script><script type='text/javascript' src='http://shuttle.sharexy.com/LoaderLite.js'></script></div></noindex><!--sharexy code end -->
noindex is not a valid tag by definition, but some search engines use them. So if you want validation, remove them.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.