Many websites, including javaeye, currently use Google auto-translation for URLs. For example, the URL of a news article in JE may be:
Http://www.javaeye.com/news/8750-google-will-launch-chrome-based-operating-system
The effect of such a URL is obvious for Seo. In fact, it is not very difficult to achieve this, as shown below:Code(The following is the Java code. The idea is very important ):
Public static string getseotitle (string Str) {<br/> string ret = ""; <br/> try {<br/> string translatedtext = translate. translate (STR, language. chinese, <br/> language. english); <br/> ret = translatedtext; <br/>} catch (exception ex) {<br/> ret = pinyin. getfullspell (STR, 2); <br/>}< br/> // additional random number <br/> random Rand = new random (); <br/> ret = utils. replace (Ret, "", "-"); <br/> RET + = "-" + Rand. nextint (1000); <br/> return ret; <br/>}
Running result:
Google-will-be-postponed-to-the-operating-system-based-on-the-Chrome-726
My practice is to use Google's auto-Translation results followed by a random number of less than 1000 to achieve the goal. If Google's auto-translation fails, the Chinese pinyin spelling will be used to add a random number, what is saved is to create a rewrite (Omitted) based on URL rules, which may be slightly different from je's practice for friends to authenticate!
Java Open Source Address: http://code.google.com/p/google-api-translate-java/
Online Demo, login: http://www.faqee.com/crm
Account/password: Test/test
Add a news item to news management. You can see the effect through the URL address!
Original article: http://cxlh.javaeye.com/blog/422372