Use hash tags with Facebook share?

I am developing an ajax-based website and I want to enable the FB sharing feature on the uploaded content. Links use a hash tag, and I can’t get all the links to be displayed when using the sharing function, I only get the domain URL. Are hash tags allowed or is there a special way to exchange such links?

+6
source share
2 answers

Use URL encoding for the # character. Just replace the following:

 http://www.example.com/#/path/to/whatever/ 

from:

 http://www.example.com/%23/path/to/whatever/ 

This will allow you to transfer # to be posted on Facebook, Twitter, etc., without receiving a split.

+20
source

Take a look at Google's answer to the AJAX content issue, hashbang .

Basically, on the AJAX page, set the hash to !/path/to/whatever/ - in other words,

 http://www.example.com/#!/path/to/whatever/ 

Remember that your server should really serve content similar to what you see in the AJAX application at http://www.example.com/path/to/whatever/ .

I'm not sure Facebook respects hashbang, but it at least solves the problems of Googlebot for you. Edit: It looks like Facebook does not support hashbang . You may have to set up a redirect page.

+1
source

Source: https://habr.com/ru/post/910212/


All Articles