向搜索引擎以外的所有人展示灯箱?
有没有什么可以让我在页面加载时向所有用户显示灯箱,但不向 Google 显示?请注意,我的技能是非常基本的 HTML,因此任何包含详细信息的回复将不胜感激。
编辑:我刚刚意识到搜索引擎无论如何都不会加载 JavaScript,对吗?这就是我的第二个问题:如何在页面加载时加载灯箱?
Is there any that that I can show a lightbox to all users on page load but dont show it to Google? Note that my skills are very basic HTML so any reply would be appreciated with details.
Edit: I just realised that search engines wont load javascript anyway, right? That comes to my second question: How do I make a lightbox load on pageload?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确实很难让机器人远离任何事情。但是,如果它们是所谓的“行为良好的机器人”(例如 Google),您可以编写 robots.txt 文件来告诉它们不要查看某些页面。看看 http://www.robotstxt.org/
所以,如果你愿意..你可以添加您保存图像的目录,以防止机器人入侵。请记住,它只会阻止遵守这些规则的机器人,这就是互联网的本质!
It's hard to keep bots off of anything really. However, if they're what's known as "well behaved robots" (such as Google) you can write a robots.txt file to tell them not to look at certain pages. Have a look at http://www.robotstxt.org/
So, if you wanted.. you could add the directory which you keep your images in to keep the robots away. Just remember it'll only keep the robots which obey these rules away such is the nature of the Internet!
要在页面加载时加载灯箱,您可以执行以下操作:
对于版本 2.04+,在第 173 行周围找到此代码(在 lightbox.js 中)并替换与以下代码类似的部分:
然后基本上附加您想要的灯箱图像首先在
标记上使用
id='first'
:回到您的第一个问题。我假设您正在尝试阻止搜索引擎机器人抓取您的图像并将其索引到搜索中。根据 @Aidanc 的建议,谷歌机器人对此非常“友善”,您基本上可以修改 robots.txt 文件,告诉机器人不要抓取某个文件夹。在您的示例中将是您的灯箱图像文件夹。例如,以下内容将禁止机器人爬行 /lightbox/images/ forlder:
To make a lightbox load on pageload you can do the following:
For version 2.04+, find this code (in lightbox.js) around line 173 and replace the part that's similar to the following code:
Then basically attach the lightbox image that you want to start first with an
id='first'
on the<a>
tag:Referring back to your first question. I am assuming you are trying to keep search engine robots from crawling your images and index into the search. As per @Aidanc suggests, google bots are pretty "nice" about it and you can basically modify your robots.txt file in a way to tell the bots not to crawl a certain folder. In your example would be your lightbox images folder. For example, the following would disallow bots crawling through /lightbox/images/ forlder: