Add data-nosnippet html attribute to a DIV contains text | Community
Skip to main content
Level 2
December 26, 2022

Add data-nosnippet html attribute to a DIV contains text

  • December 26, 2022
  • 2 replies
  • 1929 views

Dear community members,

My AEM site has a content section that is wrapped within a master Div class. To tell Google not to use textual parts of an HTML page as a snippet showing on SERP. The site's textual parts are wrapped within a master div class (<div class="content box section">)

Google Documentation: https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr


It would be a great help if, anyone here guide me on how it is possible to add HTML attributes within a DIV class.

Happy New Year in advance.
Thanks,
Saday Kumar

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

aanchal-sikka
Community Advisor
Community Advisor
December 26, 2022

Hello @sadaykumar 

 

I hope you have also explored "Robots" property available in Page properties. It has following options OOTB

 

Aanchal Sikka
Level 2
December 26, 2022

Thank you @aanchal-sikka for your reply.. 

I belive, this will add nosnippet tag for all the content present on the page. Kindly let me know will this tag help to add data-nosnippet to a piece of content section? 

 

Example

 

Lorem ipsum dolor sit amet. Eos dolore expedita ut dolores beatae ab voluptas nisi. In debitis voluptatem in aspernatur rerum sed nostrum rerum. - Fine to appear on SERP

 

Qui error dolore quo ratione dolores ut nihil mollitia vel culpa sint a cupiditate maxime sit enim tempora non voluptatibus aliquid. Ea repudiandae vero eos consequatur dolorem ab voluptas magnam et quia voluptatum! Est odio omnis hic nisi nobis eum dolor assumenda. - I dont want this content piece appear on SERP and need to add data-nosnippet within this content div. 

 

Ad eaque accusantium et voluptas suscipit eos voluptatem voluptatem et beatae praesentium **bleep** tenetur explicabo. Sit nostrum magni **bleep** dolor atque sit libero consequuntur aut corporis sunt in rerum illum. - Fine to appear on SERP

 

Hope I am able to elaborate the situation and its making sense. It would be great if you help me in this context.

 

Thanks

Saday

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 29, 2022

I would assume your AEM web page is made up of several component's, and your content author's would like granular control, on which component blocks should have the data-nosnippet or not.

How I am going to do this is by adding the data-nosnippet feature to my components. I would target the affected component's and then add a new section in the touch ui called "SEO",. Within the "SEO" section, include a checkbox for data-nosnippet. When this checkbox is enabled, the data-nosnippet will appear, and if not (default setting), the HTML element will never exist.