Facebook Like link to files - facebook

I don't find a way how to like link to a file ? Is it even possible ?
Example:
https://example.com/somefile.jpg/zip
And i would like to share that link to, so title description etc. is very desirable but I don't know where to put tags for og:url etc. since there are no meta tags at this.

That is not directly possible; we can of course not put HTML meta elements into jpeg or zip file.
But you can try and tackle this either of those two ways:
Share an HTML document instead, that returns the meta data, and triggers the actual file download via meta refresh or JavaScript. Or,
make your server return an HTML document instead of the file, only when the requesting User-Agent is the Facebook scraper.

Related

Typo3 Canonical URL in Plugin Pages

I have a typo3 Plugin (my own) which have lots of sub pages.
Now all Pages got their own canonical URL ... but I want that they only have the canonical from the page which contains the Plugin.
Is that possible?
Thanks in advance.
As far as the content changes with the parameters these parameters belong to the canonical URL.
You might not want your parameter specified pages indexed, but that needs other metatags than a non unique canonical url.
A canonical URL is used to have a unique URL for a page which can be accessed with multiple URLs. So Search engines know which URL to use and don't think of duplicate content.
If you really want to fool search engines with multiple content for the same URL you can of cause generate the base URL without all parameters and use it as canonical URL. Mind the value of config.linkVars. Just build your meta tag by hand using page.headerData.

Link query strings get cut off

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.

Adding a URL hash into meta data for Facebook and Twitter share cards

I am looking to use a hash that is given in through a URL (www.example.com/index.html#myhash) and use it in the page's metadata that Facebook and Twitter can then retrieve to make a share card like this: https://dev.twitter.com/docs/cards/types/photo-card. Is this possible? Or would it be better to just use a PHP $_GET[] variable? I'm trying to keep the page static so the hash would be ideal, but I'm fairly sure I can't dynamically create the meta tag with JS because Twitter and Facebook will not execute that code. Thanks for help!
Correct, creating the meta elements client-side will not work because those crawlers don’t execute any client-side scripting code, they just look at the HTML code they get.
And the hash part of an URL is only of client-side importance, so it does not even get passed to the server when making an HTTP request – so generating those meta elements server-side based on the hash is also not possible.
And finally, changing the hash part of an URL does not make it a different URL – so this is not compatible with Facebook’s Open Graph philosophy, where the equation is one URL == one OG object.

The title, link and description don't work

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

Get google to index links from javascript generated content

On my site I have a directory of things which is generated through jquery ajax calls, which subsequently creates the html.
To my knwoledge goole and other bots aren't aware of dom changes after the page load, and won't index the directory.
What I'd like to achieve, is to serve the search bots a dedicated page which only contains the links to the things.
Would adding a noscript tag to the directory page be a solution? (in the noscript section, I would link to a page which merely serves the links to the things.)
I've looked at both the robots.txt and the meta tag, but neither seem to do what I want.
It looks like you stumbled on the answer to this yourself, but I'll post the answer to this question anyway for posterity:
Implement Google's AJAX crawling specification. If links to your page contain #! (a URL fragment starting with an exclamation point), Googlebot will send everything after the ! to the server in the special query string parameter _escaped_fragment_.
You then look for the _escaped_fragment_ parameter in your server code, and if present, return static HTML.
(I went into a little more detail in this answer.)