2016-06-04 22 views
7

Sto cercando di utilizzare ajax-seo per un'applicazione Angularjs per pubblicare contenuto compilato html da un server Web PhantomJS`. Ma non sta visualizzando la pagina completa. Sta dando la seguente rispostaPhantomJS supporta ES6 per servire l'app angularjs ai crawler e ai bot?

<html><head></head><body></body></html> 

Ho seguito bene le istruzioni ma finora non ho avuto fortuna. Quindi mi piacerebbe sapere se PhantomJS supporta ES6 o no, perché la mia app è in ES6.

+0

Quale versione di PhantomJS usi? Registrarsi agli eventi 'onConsoleMessage',' onError', 'onResourceError',' onResourceTimeout' ([Esempio] (https://gist.github.com/artjomb/4cf43d16ce50d8674fdf#file-1_phantomerrors-js)). Forse ci sono errori. –

+0

@ArtjomB. Sto usando la versione di phantomjs '1.9.0'. Sto usando lo script da https://github.com/liuwenchao/ajax-seo/blob/master/seo.js –

+0

@ArtjomB. Anche dopo l'aggiunta di 'onConsoleMessage',' onError' e altri metodi specificati dall'utente, non si ottiene alcun errore. Semplicemente ricevendo l'output come prima dello –

risposta

7

PhantomJS 2.1.1 supporta solo circa il 10% di ECMAScript 6, che potrebbe non essere sufficiente per il rendering corretto della pagina.

Ecco un risultato leggermente più dettagliato sulla base di https://kangax.github.io/compat-table/es6/:

 
Overall coverage: 10% 
> Array is subclassable: 0/11 
> Array static methods: 0/11 
> Array.prototype methods: 0/10 
> Date.prototype[Symbol.toPrimitive]: No 
> Function is subclassable: 0/6 
> HTML-style comments: Yes 
> Map: 0/19 
> Math methods: 1/17 
> Number properties: 0/7 
> Object static methods: 0/4 
> Object static methods accept primitives: 0/10 
> Object.prototype.__proto__: 6/6 
> Promise: 0/8 
> Promise is subclassable: 0/4 
> Proxy: 0/34 
> Proxy, internal 'defineProperty' calls: 0/2 
> Proxy, internal 'deleteProperty' calls: 0/6 
> Proxy, internal 'get' calls: 0/36 
> Proxy, internal 'getOwnPropertyDescriptor' calls: 0/4 
> Proxy, internal 'ownKeys' calls: 0/3 
> Proxy, internal 'set' calls: 0/11 
> Reflect: 0/20 
> RegExp "y" and "u" flags: 0/5 
> RegExp is subclassable: 0/4 
> RegExp syntax extensions: 8/8 
> RegExp.prototype properties: 0/6 
> RegExp.prototype.compile: Yes 
> Set: 0/19 
> String static methods: 0/2 
> String.prototype HTML methods: 3/3 
> String.prototype methods: 0/10 
> Symbol: 0/11 
> Unicode code point escapes: 0/2 
> WeakMap: 0/12 
> WeakSet: 0/11 
> __proto__ in object literals: 1/5 
> arrow functions: 0/13 
> block-level function declaration: No 
> class: 0/24 
> const: 1/16 
> default function parameters: 0/7 
> destructuring, assignment: 0/24 
> destructuring, declarations: 0/22 
> destructuring, parameters: 0/23 
> for..of loops: 0/9 
> function "name" property: 3/17 
> generators: 0/27 
> let: 0/12 
> miscellaneous: 2/10 
> miscellaneous subclassables: 0/6 
> new.target: 0/2 
> non-strict function semantics: 2/3 
> object literal extensions: 0/6 
> octal and binary literals: 0/4 
> own property order: 4/7 
> proper tail calls (tail call optimisation): 0/2 
> prototype of bound functions: 0/5 
> rest parameters: 0/5 
> spread (...) operator: 0/15 
> super: 0/8 
> template literals: 0/5 
> typed arrays: 19/46 
> well-known symbols: 0/26 

Questo Gist contiene i dati completi così come lo script che lo ha generato.

+0

vuoi dire che non dovrei usare phantomjs in quanto non renderà il web completo scritto in ES6? –

+0

Si potrebbe dire questo. Puoi anche provare a usare un transpiler per convertire il tuo codice base in ES5. –

+1

Grazie per la vostra risposta. Ancora una cosa voglio sapere che cosa sono l'alternativa a questo? Come posso rendere l'app angularjs basata su ES6 SEO-friendly? –