Tại sao lập trình viên JavaScript nên hiểu cơ bản về SEO? Mặc dù các công cụ tìm kiếm hiện nay đã có thể quét mã nguồn JavaScript của bạn để xác định nội dung ẩn bên dưới nhưng lời khuyên của các chuyên gia SEO vẫn là: "Hãy cẩn thận khi dùng JavaScript trên site của bạn".

Bởi dùng quá nhiều JavaScript hoặc cấu trúc JavaScript quá phức tạp thì các cỗ máy tìm kiếm cũng có thể bó tay khi không thể quét đúng nội dung bạn muốn hiển thị trên các trang tìm kiếm; hiển nhiên điều này sẽ không tốt cho SEO một chút nào.

Các bài viết liên quan về SEO và JavaScript mà bạn không nên bỏ qua:
- JavaScript có tác động đến các chiến lược SEO?
- SEO và JavaScript trong Phát triển web

Nhãn: chuyên gia SEO, công cụ tìm kiếm, cấu trúc JavaScript, cỗ máy tìm kiếm, không tốt cho SEO

Miễn phí web hosting 1 năm đầu tại iPage

Nếu bạn vẫn còn đang tìm kiếm một nhà cung cấp hosting đáng tin cậy, tại sao không dành chút thời gian để thử với iPage, chỉ với không quá 40.000 VNĐ/tháng, nhưng bạn sẽ được khuyến mãi kèm với quà tặng trị giá trên 10.000.0000 VNĐ nếu thanh toán cho 24 tháng ~ 900.000 VNĐ?

Có trên 1 triệu khách hàng hiện tại của iPage đã & đang hài lòng với dịch vụ, tuyệt đối chắc chắn bạn cũng sẽ hài lòng giống họ! Quan trọng hơn, khi đăng ký sử dụng web hosting tại iPage thông qua sự giới thiệu của chúng tôi, bạn sẽ được hoàn trả lại toàn bộ số tiền bạn đã sử dụng để mua web hosting tại iPage. Wow, thật tuyệt vời! Bạn không phải tốn bất kì chi phí nào mà vẫn có thể sử dụng miễn phí web hosting chất lượng cao tại iPage trong 12 tháng đầu tiên. Chỉ cần nói chúng tôi biết tài khoản của bạn sau khi đăng ký.

Nếu muốn tìm hiểu thêm về ưu / nhược điểm của iPage, bạn hãy đọc đánh giá của ChọnHostViệ nhé!
Thử iPage miễn phí cho năm đầu tiên NGAY

If you want to make a positive impression when you present your project to a panel of SEO guys, you totally need to know how they think about JavaScript, because it will help you to get that job and your knowledge of SEO basics will set you apart.

Back in the days of IE6

The thing is that JavaScript - since it's been introduced with IE6 - has been notorious, because of the fact that it's not SEO-friendly at all. Search engines were not even able to crawl content served by JavaScript. Thus Google literally recommended avoiding JavaScript in websites. As more and more sites start using the technology, search engines will try to catch up with the trends and refine their algorithms. It goes without saying that they will finally make their crawlers read JavaScript where possible.

What is Visible to Search Bots Nowadays?

At the time of this writing, Google can execute some JavaScript (Facebook and Disqus comment, etc.), but only if you keep it as simple as possible. You can use document.write and pretty safely. Unfortunately, we don't know to which extent exactly Google spiders can crawl JavaScript code. Matt Cutts - a guy from Google who usually "discloses" some Google algo secrets - was never too specific about that aspect. Back in 2011, he said: "Google can execute AJAX/JS to index some dynamic comments." The only viable data is obtained from SEOs who actually take the plunge and conduct experiments.

By the way, Matt Cutts is a big authority in the SEO community. So, if you refer to him while proving that your idea is a fabulous one. The best way would be to based your arguments on the articles where Matt talks about JavaScript and SEO. It's a sure-fire way to convince just about every search engine optimization manager. Now let's take a closer look at how to talk to SEOs.

What to Say to an SEO

Though the major search engines already can crawl plain JavaScript content, most SEOs are still very reluctant to use it on their sites and you need to really know how Google and others treat JavaScript to convince your SEO that it's OK to use the language in that particular case.

For starters, you need to emphasize the fact that your .js effects will improve user experience, because it's one of the things that both SEOs and marketers in general really value.

That done, you need to present your technical findings as for how your JavaScript code is absolutely safe in terms of inbound marketing also known as SEO. In order to provide with sound arguments, you need to take the following into consideration.

SEO Friendly Use of JavaScript

Make sure to implement your JavaScript specifically to supplement user experience, but be advised not to use it to render actual content. As a rule of thumb, you need to avoid using JavaScript where possible. Instead, you may want to use both HTML5 and CSS3 which are way more user friendly in many cases.

In case you really need to use some JavaScript, be sure to run tests with the help of a text browser or just disable JavaScript in yours. That will allow you to see how your content is accessible to Googlebot, which is a text-based browser as well. If you can see searchable content that you deliver with the help of JavaScript, then it's most likely OK and it will be crawled and indexed by search engines.

Also, you don't want to use multiple parameters in your code, because it drastically slows down search engines' speed while crawling sites. The slower a search engine bot crawls your site, the less chances to high rankings for your site. So, you should really care about how your code performs in its natural SEO habitat.

As a workaround, you can externalize your JavaScript in an .js file, because it will allow to execute your code way faster. Plus it will make your HTML way less cluttered up.

Befriend an SEO

If you work in a team that has an SEO expert on board, you need to consult with him or her on a regular basis, because it will ensure that you're not working on something that will be rejected after you've worked on it for a few days.

Say, you've got this truly amazing idea to add a super cool effect JavaScript in site navigation (menu buttons). Then you talk to your SEO and he arrogantly gives you a big no-no to that creative idea. The reason is simple: crawlers won't follow any links in JS. And it's just a quick example from many possible issues. Again, if there's a way to do something without JavaScript, do it.

Surprise an SEO

You may make a better impression if you offer a solution to a problem that your SEO did not think to use your services for. The thing is that infographics have been all the rage in the SEO world for a while, but now they are not working that good, because they were overused specifically for the fact that they generated the same anchor text and alt from all sites that embedded them. You could offer enabling dynamic anchor text and alt tag value generation so that the links and alts get as diversified as possible.

Doing so will testify that you're not jus an awesome JavaScript guy or girl, but you're pretty aware of the intricacies of modern SEO.

The Bottom Line

As you probably know by now, most SEOs are really biased as for JavaScript use in their sites, but you can convince them to implement a few cool and SEO-friendly effects (that you'll be paid for) if you are able to show that you're also well versed in terms of technical on-page SEO as long as JavaScript is concerned. If you make that sort of impression at least once, you'll get referrals and consequently more projects, because it's extremely hard to find JavaScript gurus who develop projects with SEO in mind as well.

Tác giả

Kenneth von Rauch is an avid SEO guy who's confident that we can make the Internet a better place to deal with if we create sites with both best web development and SEO practices in mind. He's with, a site about inbound marketing, web development and everything in between.

Đây là một bài viết cộng tác, tham gia NGAY để chia sẻ nhiều bài viết, tài nguyên và thủ thuật hay đến các độc giả tiềm năng của bạn với nhiều lợi ích.

JavaScript theo ngày

Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web