0

before implementing history.pushState my site I wonder if there is any way to change or to include data generated URLs as targets for social networks such as fb, these metatags are essential for sharing content:

<meta property="og:title" content="My website"/>
<meta property="og:image" content="http://www.example.com/facebook/road.jpg"/>
<meta property="og:site_name" content="Website"/>
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.example.com/" />

My website load content via AJAX and do not really know what would be a viable solution for sharing ajax generated content in social networks.

In addition I have plugins facebook comments and likes on my website without a URL do not work, always count the likes of index.php

Another solution I think is to make a copy of each content loaded by Ajax in new HTML pages and are these that are used to share content, but do not know if this will be good. Is it bad for SEO do this? ¿Penalize me for duplicate content?You could generate a sitemap?

Can I help you could decide?

The1Fitz
  • 662
  • 4
  • 8
pTRONICA
  • 59
  • 10

1 Answers1

0

I am working on the same, but so far have not used jQuery, just pure javascript. I have my pushstate and popstate working, and have added a hidden div to my textfiles that is loaded in through ajax. when a user refreshes, or is directed with a url share, page is loaded without styling. He/she then have to go to the home page and start from scratch, so that is one problem I have yet to solve. I put inline styling on my div, that is hidden in my styles.css file, but covers the screen with a link to my homepage, when the page is loaded without style. Horrible I guess, I want to achieve something like, get the state from the url and go there, but haven't found the solution yet.

But in more relevance to your question, I came across this

<a href="https://developers.google.com/webmasters/ajax-crawling/docs/specification">here in developers.google!</a>

if www.example.com has no hashframents, and contains in the head, the crawler will transform this URL into www.example.com?_escaped_fragment_= and fetch www.example.com?_escaped_fragment_= from the web server.

This make me thin I can acieve what is done with _escaped_fragment_= without adding a # or ! to my url's. I am no pro developer, but have seen this as the solution for #! based sites, but on very old questions, like

<a href="http://stackoverflow.com/questions/2568760/is-it-possible-to-use-    javascript-to-change-the-meta-tags-of-the-page">this one,</a>

wich now is very relevant for many developers that want to give facebook the correct info from ajax webpages/apps, in og:title etc..

sunto
  • 87
  • 1
  • 1
  • 10
  • Or am I correct to assume this adds #!, or that i need to change my ajax setup so that it has #! in the url, I am not so sure.. – sunto Nov 22 '15 at 00:50