简体   繁体   中英

Make AngularJs crawlable for search engines

I am a noob with angular, and making javascript crawlable. I've been searching for it, but I don't really get it so far.

I am working on a AngularJs thingie which is using client-side JSON. There is a navigation with pages, but... each link is using a function getPage(n) to slice a chunk of JSON and Angular renders it.

Is it OK to put a href="#!page=n" to each link? When I add that hash #! to the url and press enter, and a function renders the right items, is that enough to make it crawlable?

I've read something about snapshots, but it requires Java? I have a webhost which is not really flexible, it does NOT TomCat or NodeJs.

I think it's much better practice these days to use HTML5 history.pushState , and thus provide a unique URL for every page.

More information here.

Check this older stackoverflow question - Making angular crawlable - Beginning of Project

A friend of mine uses - https://prerender.io/

Both these solutions are essentially caching versions of your rendered views, so the crawler can index your site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM