I have a page of products on my website with a share button on each, now how can I tell facebook to automatically select the title and image of the product shared rather than the whole page.
A link to my site
The site is written using php on smarty type script with tpl files,
ps i dont really know php very well.
Thanks in advance :)
A server side scripting language would be the easiest:
in php you could share the page + an extra variable , then if your page detects this variable you can set specific meta data.
http://www.fancydressclothing.net/categories/49/1950s-Costumes.php?product=1
And in php fetch the correct data for product 1 and set the meta data:
http://developers.facebook.com/docs/opengraph/
You should use a canonical URL for each product which will help in two ways. One with the facebook linter getting the correct og tags. And two, helping your SEO rankings too.
Related
I'm not aware of link designing strategies, so I am not sure why my link gets chopped off when someone clicks on from sources like Facebook etc.
I have a 'share feature' on my platform, which lets a user create a link to their listing and share it with people.
The link I generate for the listing in my backend has parameters, which reads the listing id and the type and displays content over HTML
Here's a sample link for a listing
https://www.fayvors.com/Share.html?hash=5eccccaa-7b8d-42bd-af8c-08d50da0c867?type=lessons/
However, when I share the link on facebook and click it, the browser redirects to a link that's cut off
https://www.fayvors.com/Share.html?hash=5eccccaa-7b8d-42bd-af8c-08d50da0c867%3Ftype%3Dlessons
I'm not aware of link designing principles, so I'm a bit lost here!
Thanks!
Your URL contains “special characters” (like a second question mark inside the query string), but you neglected to apply proper URL encoding when putting this URL as a parameter value into another URL:
javascript:window.location.replace('https://www.facebook.com/sharer/sharer.php?u='+window.location)
Use encodeURIComponent on the value you are concatenating to the sharer URL here.
I am working on an online store.
It's made with Prestashop 1.3.6
I am trying to embed a like and send button in the product page.
I have set up my og tags,and tested it with the debugger.
My problem is that the tags only get read by facebook if I hardcode them in the header.tpl.
If I pass smarty variables the tags appear as empty.
It's kind of driving me crazy because I can not find someone with the same problem.
The tags appear in the browser source code in both cases (hard-coded and variable).
But facebook reads them only when I hardcode them.
Here is the link to my site,maybe you can figure it out.
The thing that I don't understand is that before putting og:tags,facebook was taking the default title and description tags off my page.
And those tags were passed by variable.
So I really don't understand why it doesn't work.
Any ideas ?
Thanx a lot in advance!
Is it possible to have multiple og:title(etc) in a page?
I have 4 different products on same page (url: site/#theblock)
I want my users to share the product with the correct link on their FB.
I tried jquery but its not working.
Im using a wordpress cms.
Any idea how to do it?
Thanks
You need to use some server side technology to dynamically change the og tags based on query string parameters. Hash tags will not work since they are only used by the browser and are not sent to the server.
The reason to set the og tags server side is because Facebook's scraper does not run JavaScript and therefore your server needs to make the correct tags upon serving the page.
I've been reading guides and examples for a long time (hours) but I can't manage. I tried to use all html meta tag like title, description, and og:property. Also tried to use the link sharer and also to create a new blank page with just the info I want to share to facebook in order to test. Also I tried to generate an random url in php so to have always a different url variable (the url to share and also the url of the main page containing the script). I also grabbed (url linter) a lot of time the url to clean the cache of facebook. It always give me the title of the site domain as title or the url itself as the shared title and description. I don't know what to do.
The main web site is from joomla. In the code of index of joomla I put a php include if the url has the variable "articolo" id. This incuded php page has regulat head body etc. So maybe I facebook check the main meta of joomla first? So now I tried to open a popup with just the page for sharing. Look here: link
It's possible that the title is locked in, meaning that after X number of likes Facebook doesn't allow you to change it anymore. Can you give us an example URL you're having issues with?
EDIT
Ok, now the link you provided shows some very interesting output. http://modernolatina.it/wjs/index.php?option=com_content&view=article&id=96&Itemid=258&autore=6&articolo=6
First, you webserver, instead of sending back a 200 code, is sending back a 500 code.
Secondly the HTML your webserver is sending back has two HTML tags (Do a view source on the content returned)
Fix up those two issues and I think the linter will be happier with your page.
Test your page here:
http://developers.facebook.com/tools/debug
When you share something on Facebook or Digg, it generates some summary of the page. How would I do this in Perl? What algorithms are there?
For example:
If I go to Facebook and tried to share this question as a link:
How can I create a website summary with Perl?
It retrieves "Facebook/Digg get website summary? - Stack Overflow" as the title (which is just the title of the page) and [... incomplete question?]
CPAN is your friend.
Some promising looking modules:
HTML::Summary
HTML::SummaryBasic
Lingua::EN::Summarize
Assuming you mean sharing a link...
Usually the summary is written by the user submitting the URL. If you have to write a summary automagically this can be achieved by:
Using the first 100 or so characters of the document body (in itself not easy)
Using metadata like the description or keywords (often empty or spammed)
Context-relevant summaries like recreating Google snippets (sorry its PHP but simple)
Tags/keywords from the document using something like the Yahoo Keyword Extractor API or your own keyword density function
Your best bet is to ask the user!
Hope that helps somewhat :)
Basically you want to scrape the URL and find the "most significant paragraph" which might be the first <div> or <p> element after the first <h2> or <h1>, depending on the layout of the page.
You could check and see if there is a meta description on the page, but that leaves you at the mercy of whoever wrote the meta description.