Aplicación que no es de una sola página: use pushState para cambiar la URL en la barra de direcciones al hacer clic
Frecuentes
Visto 259 equipos
0
So my app is not SPA. I use Angular in certain spots and sometimes on a whole page but what I see in my address bar is my server page (PHP).
Now, there is a page where I'd like to have my categories displayed as clickable links/buttons and to display listings of clicked categories.
While this isn't too difficult to implement, I'm worried about the SEO aspect thereof.
I came across pushState
thing which should "seemingly" change the url on button click.
You can see it in action here html5.gingerhost.com
You can verify that the page is not changed by playing Youtube video on the right prior to clicking any buttons.
Now, I wonder if there is any chance I can utilize this in my ng-click
method. The indented behavior is to have the URL in the address bar to keep my server page in place, and just add my category seo name after it.
0 Respuestas
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas javascript html angularjs angularjs-directive angularjs-routing or haz tu propia pregunta.
ng-click
is a directive that attaches aon('click')
event handler on your link. You need to sethref
to something googlebot can read: stackoverflow.com/questions/6193858/pushstate-and-seo - Sergiu Paraschiv@SergiuParaschiv I just tried adding
ng-href
to a link and seeing if it'd take me anywhere. It didn't. Actually nothing happened. I'm afraid I'm not following you completely. - developer10The point is any AngularJS directive modifies the DOM throught JavaScript. Googlebot will understand algo JavaScript you throw at it, but what AngularJS directives do is too complicated and basically ignored. Googlebot on the other hand does understand basic
pushState
manipulación if your hyperlinks (a
tags) have correcthref
attributes (that have not been added through JS DOM manipulation) pointing to the actual HTML fragment to be loaded asynchronously. Song-href
,ui-sref
,ng-click
or any other AngularJS directives won't work. - Sergiu Paraschiv@SergiuParaschiv So you're saying that along with using
pushState
for changing my URLs I need to have correcthref
(más bien queng-href
) set in order for Google to understand it? - developer10Yes. It's all explained in the first question I linked to. - Sergiu Paraschiv