How to markup advertisement?

2019-08-12 16:47发布

How to markup advertisement to have it excluded from search?

My specific problem is that I have the below code outside the main and article elements on my pages. Going from a purely semantic to a real world problem: Sharing a link to my page on Google+, Facebook, and Twitter will use the advertisement image to represent the content.

<aside>
  <a href="http://www.example.com/ad" rel="nofollow">
    <img src="/example_com.png" /></a>
</aside>

The social networks’ documentation tells me how to specify which image to use. But for much of my content, no image would be the best option. None of them explain how to achieve that.

For Google Custom Searches I could have tweaked my code to <aside class="nocontent"> to achieve this. But according to Google’s documentation, this does not affect normal web search. Testing shows that none of the social networks respect this either.

2条回答
闹够了就滚
2楼-- · 2019-08-12 16:59

If the advertisement is not part of your content (instead of, e.g., a blog post about a product), using the aside element would be correct from the HTML perspective:

The element can be used […] for advertising […]

If some third party services simply scrape any image if you don’t provide one with semantic annotations (e.g. in RDFa, Microdata or Metatags), I’d say it’s a bad service.

You could try some "hacks" and then check if these services stop using the ad image:

  • use an iframe element for the advertisement (maybe the services don’t check iframe content)
  • use the object element instead of img (maybe the services only look for img)
  • load the ad via JavaScript (maybe the services don’t run JS)
查看更多
时光不老,我们不散
3楼-- · 2019-08-12 17:14

Hmm if I understand you right you want to declare the semantic markup of ads non indexable.

Here's the first place I checked-> http://schema.org/WPAdBlock

查看更多
登录 后发表回答