JS动态更换图片和SEO

发布于 2024-08-25 08:53:17 字数 410 浏览 11 评论 0原文

我使用 jquery 构建了一个网站,以在内容之间进行良好的转换。

代码是这样工作的:有 2 个 imgs(正文和页脚)。

当我单击链接(而不是转到另一个页面)时,我淡出 2 个 imgs 并更改 2 个 imgs 的 src 属性。加载新 imgs 时,我将它们淡入。

我正在使用 SWFaddress< /code> 允许用户直接进入内部内容。

现在我想让我的内容被谷歌和其他搜索引擎索引, 所有文本内容都在 imgs 内,所以我在 ALT 属性中得到了文本。

我的问题是:

如果使用 JS 动态更改 imgs ALT 属性,蜘蛛是否能够正确读取它?

假设我正在使用 SWFaddress 创建站点地图。

I've built a web site using jquery to make nice transitions between content.

The code works this way: there are 2 imgs (body and footer).

When I click on a link (instead of going to another page) I fade out the 2 imgs and change the src attribute of the 2. When the new imgs are loaded I fade them back in.

I'm using SWFaddress to allow user go directly to internal content.

Now I'd like to make my content indexed by google and other Search engines,
all the text content is inside the imgs, So I've got the text in ALT attribute.

My question is:

If a dynamically change the imgs ALT attribute using JS, will spiders be able to read it properly?

Consider that I'm using SWFaddress to create a sitemap.

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

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

发布评论

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

评论(3

欢你一世 2024-09-01 08:53:17

搜索引擎机器人通常不处理 JavaScript。所以不。

Search engine robots generally do not process JavaScript. So no.

携君以终年 2024-09-01 08:53:17

你这样做错误

如果您希望一个包含大量 JS 的网站对机器人和没有启用 JS 的人类都有好处(例如,想象一下使用屏幕阅读器的盲人),您需要使用文本格式的内容来开发您的网站没有任何 javascript

然后,您可以在页面加载时使用高级 JavaScript 框架(如 jQuery)来替换内容并更改导航、表单提交等(您知道,众所周知的 $(document).ready(function( ){/*...*/});

这样您就可以两全其美:“酷”的动画和良好的可访问性(这意味着良好的 SEO)。

You're doing it wrong.

If you want a website with a lot of JS to be good for both bots and human without JS enabled (think of blinded people with screen reader for instance), you need to develop your website with content in text format and without any javascript.

Then you use high level JavaScript framework like jQuery to replace the content and change the navigation, form submission etc. as you want when the page is loaded (you know, the well-known $(document).ready(function(){/*...*/});.

This way you'll have the good parts of both worlds: "cool" animations and good accessibility (which means good SEO).

空城之時有危險 2024-09-01 08:53:17

我对 SWFaddress 不熟悉,所以我的建议可能不正确。

但 Googlebot 会抓取一些 javascript 并将其编入索引。对于 Bing/Yahoo 则不一定如此。

Google 知道网站正在不断发展,Flash 和大量使用的 AJAX 网站等内容很受欢迎,为了实现“组织世界信息”的目标,他们需要抓住这一点。

您可以在此处找到有关 Google 抓取 Flash 并将其编入索引的能力的信息:http:// /googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html

最近,他们谈到了在相当确定内容时如何对 AJAX/XHR 内容进行抓取和索引:http://googlewebmastercentral.blogspot.com/2011 /11/get-post-and-safely-surface-more-of.html

如果你查看 github,他们有非常流畅的 AJAX 体验,但是当你浏览存储库的文件夹时,它会发出 POST 请求获取额外的 XHR 信息。借助新的 Google 抓取功能,他们应该能够更轻松地索引 github 内容,而不必退回到非 HTML5 un-popstate 体验。

但我会回应其他回应,即您确实应该努力使残疾用户可以访问您的网站,而不仅仅是使用屏幕阅读器的用户。听起来你已经在这样做了,所以向你致敬。

最重要的是,您正在创建的 AJAX 内容很有可能获得正确的索引,但是,您可能希望按照 Google 所说的他们知道的方式来实现它。

I'm not familiar with SWFaddress so my advice could be off.

But Googlebot will crawl and index some javascript. The same can't necessarily be said about Bing/Yahoo.

Google understands that sites are evolving and things like Flash and heavily used AJAX sites are popular, and to achieve their goal of "Organizing the World's Information", they need to get at it.

You can find information about Google's ability to crawl and index flash here: http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html

And more recently they talked about how they are crawling and indexing AJAX / XHR content when they're reasonably sure of the content: http://googlewebmastercentral.blogspot.com/2011/11/get-post-and-safely-surfacing-more-of.html

If you look at github they have a very slick AJAX experience, but as you navigate through the folders of a repo, it makes POST requests to get the additional XHR information. With the new Google crawling abilities, they should be able to more easily index github content without having to fall back to the non-HTML5 un-popstate experience.

But I would echo the other responses that you really should strive to make your site accessible to disabled users, which is more than just users using a screen reader. It sounds like you're doing that already, so kudos to you.

Bottom line, the AJAX content you're creating has a good chance of getting properly indexed, however, you might want to implement it in the way that Google's said they know how.

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