div 中的背景图像谷歌索引?

发布于 2024-08-23 08:38:15 字数 403 浏览 6 评论 0原文

我有一个空 div 列表并动态插入背景图像 - 所以首先,它们的背景图像: url();财产完全是空的。对于某些事件,它的背景图像 url 会加载到之前空的背景图像中: url();标签。出现的背景图像的 url 暂时存储在 div 的“alt”标签中:

我这样做是为了在不使用透明 gif(没有平滑边缘)的情况下在几个动画 gif 上获得圆角。

问题:Google 机器人会索引这些图像吗?我可以想象他们这样做是因为 url 已经存储在 html 代码中,而不是存储在某些外部 css 文件中,但不是作为“img”标签,而是作为“alt”或“something”标签!?

I've a list of empty divs and dynamically inserting a background image – so at first, their background-image: url(); property is completely empty. With some event, it's background-image url loads into the previously empty background-image: url(); tag. The url of the appearing background-image is temporarily stored in the "alt" tag of the div:

<div style='background-image: url();' alt='http://something...'></div>.

I'm doing so to get round corners on several animated gifs without using transparent gifs (no smooth edges).

Question: does Google robots index those images? I could imagine they do because the url is already stored in the html code and not in some external css-file, however not as "img" tag but as "alt" or "something" tag!?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撩动你心 2024-08-30 08:38:15

我认为 @Paolo 的答案总体上是正确的,但有些机器人可能会寻找页面中引用的任何类型的图像资源 - 这并非不可想象,当然也不是不道德的。

如果您想确保没有搜索引擎对图像建立索引,您可以设置 robots.txt 文件来阻止它们。

如果您想确保机器人确实对它们进行索引,您可以例如设置一个包含带有所有图像的 标签的页面,并放置一个无害的链接将该页面放到您的首页上。

I think @Paolo's answer is correct in general, but some bots might look for any kind of image resource referenced in the page - it's not unthinkable, and certainly not unethical.

If you want to make sure no search engine indexes the images, you can set up your robots.txt file to block them.

If you want to make sure bots do index them, you could for example set up a page containing <img> tags with all the images, and put an innocuous link to that page onto your front page.

め可乐爱微笑 2024-08-30 08:38:15

Googlebot(像大多数蜘蛛一样)不会尝试运行 javascript,因此它唯一索引的内容是从服务器下载的原始 HTML 中出现的内容。 JQuery 的任何后续操作都不会发生。

另外 - 大多数蜘蛛也不索引 CSS,因此背景图像也将被忽略。

Googlebot (like most spiders) does not attempt to run javascript, so the only things it will index are the things appearing in the original HTML downloaded from the server. Any subsequent manipulation by JQuery just won't happen.

Also - most spiders don't index CSS either so background-images will also be ignored for that reason.

一花一树开 2024-08-30 08:38:15

Googlebots 肯定会索引 IMG ALT 属性。我真的不知道他们随后是否会检测到替代文本包含 URL 并查看它们。

在我看来,这似乎是对 alt 属性的滥用,坦率地说:DIV 不应该(不)具有 ALT 属性,即使有,这也不是它们的用途。

Googlebots will certainly index IMG ALT attributes. Whether or not they subsequently detect the fact that alt texts contain URLs and go looking at them, I really don't know.

This seems to me an abuse of the alt attribute, frankly: DIVs shouldn't (don't) have ALT attributes, and even if they did, this is not what they are for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文