Comments with Facebook for different news on site

Asked

Viewed 518 times

0

I’m developing a website that will have several different posts (like a blog, for example). I added the comment plugin with Facebook, so that users who access can comment. However, I am in the following situation:

User accesses a news: nameserves.com/news? id=1

The news is displayed and at the end the comment system is displayed. When the user comments, the comment is saved. But when opening other news:

nomedosite.com/noticias? id=2

, previous news comments appear together. I need each news to have its 'line' of comments. How can I do this?

  • the moderators are hellish but this is simple even more in blog.. but this plugin you used without setting right naorola...

2 answers

2


Good morning. It is very easy to solve the problem you are having. In Facebook API there is a parameter to be passed in the code that you lock that comment object with the URL that you decide.

If on your site you have news that is in the URL http://meusitebacana.com/noticia-2, in the code you will implement so:

<div class="fb-comments" data-href="http://meusitebacana.com/noticia-2" data-numposts="5">
</div>

Where the data-href will set to facebook what news url you want the comments.

In PHP, in the course of programming, you write this url there.

It is important to stress that: This URL cannot be dynamic, and if you mount it like this: $url = "http://".$_SERVER["SERVER_NAME"]."/".$_SERVER["REQUEST_URI"]; and the person accessing http://meusitebacana.com/noticia-2?utm_source=google, the URL will look different and the object of the comments will also be another. Then there will be duplicate comments to a single URL (which is not what you expect).

To Facebook API assemble the code for you, just access.

I hope I’ve helped.

  • Nothing to see! In the API there’s nothing like that there. It’s all wrong. Comments duplicity is impossible unless the user comments twice. The API does not mount anything, it has is a documentation with code for plugins implementation .

  • With the Canonic URL defined in the implementation, it will comment on the url defined, regardless of what variable is hanging at the end of the url. In the same way that if it is set it will only comment and display comments from the defined URL. But without the full implementation will not comment is nothing. Who is the moderator of the comments... ehn

  • @Davidaugustus , Look at the Facebook Documentation website: https://developers.facebook.com/docs/plugins/comments ... The first step is 'Choice.

  • whatyson the api is something else. vc refers to the code generator .. in this case then the Canonical is thing of its code... calls me in fb.me/davidaugustus42 pq ess3s shit of these admin n let me help ..

  • Have you done it or not yet

-2

To implement the Comments, you need 3 things, first is the Open Graph, to define the properties of the page that will be commented, including, eventually, URL Canonico. Second, it is the Facebook SDK. Third, the Plugin markup element. In this element, you must specify the object or URL that will be commented by this plugin. If this element is outside a structure for example: There is a product inside the page, which has head~lho and footer . If you put it into the dynamic content of the product, with the specific URL, it will work every time. But Voce can also have one in the footer, specifying any of the URLS you prefer. Remembering that TO COMMENT SOMETHING, you should know WHAT WILL BE COMMENTED, because the plugin is not simply a tool to collect comments and display them. It generates activities within Facebook, very significant for the performance of content distribution. In this case news should be categorized as news type. And it should contain information about the date of publication, as well as the author. There are several other details, to implement the comments, you must search Open Graph before and after the Like and Share button for websites .

  • Hello @David. Your answer is very confusing. Try to be clearer, including code if necessary. But more importantly structure the text.

  • True @Joãomartins. We recommend that you access the guide on how to format questions and answers, available on this link. It can help you improve your answers/questions and also clarify some questions.

  • Moderators, come take it in the middle of your ass! I’m not here to format fucking not your broken in. Cell phone typing. And two shits come to mark my answer? Fuck you.. Bastard. This is not the place of text formatter. And my answer is confusing because they’re a bunch of Hell-head fish. I write a lot worse than this is in EN on the stack years ago. Now your dick in the ass can’t collaborate?? Answers better then the scrotum horn and daughter of a whore. I recommend you access your ass to see if you can find the answer on how to use your brain. I’m trying to help you .

  • What am I going to put code for if the answer is conceptual about something that even the question has code??? the guy has a blog his idiots. blog. It is not code that el3 need mt less Formtacao. You are a bunch. The previous answer is wrong and I will get out of this pussy here. I’ll collaborate only on the regular stack. idiots

  • stooges... Ammers.. noobs.. laymen... juniors... apprentices..

  • I was already actively collaborating online. Bunch of shit. What do you think this is?? A spelling and grammar forum? Need a babaovo? that "my questions" you think I resort to this here to ask question? not question I do not. I have is almost 20 years of internet.... i can read. And write. Research. I learned it was with years reading. And fix Formtacao until a donkey corrects. . your jerks. mizeraveis. pivetes.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.