I'm working on a site where the locale is required as part of the URL (e.g. http://example.com/content/locale).
If you don't enter a locale (e.g. http://example.com/content) you're shown an error page and asked to choose a value from a list.
For most external sites we just omit the locale and let the user choose, however, for Facebook this causes the crawler to scrape the error page.
If we include each locale as a separate og:url this would mean thousands of objects created for each page (as we support that many locales) and potentially hundreds of thousands for the site.
Does Facebook allow such large numbers of og:urls for a domain?
Is there a better strategy I can use?
Facebook expects caninical urls to not directly include a locale code. Including some locale code in the URL will mean you have different objects in the graph, one for each locale.
Instead, create urls which don't include the locale code. On each of your other user-visible urls which do include the locale code, add an og:URL tag that points to the canonical URL without the locale code in it.
On the canonical URL, when Facebook makes a request, look for the useragent string. It if contains "facebookexternalhit" then return HTML and og markup for Facebook to read. If it doesn't, you can serve a 302 and redirect the user to the URL which represents the object in their language.
See FB's open graph internationalization docs for more on how to handle multi-locale objects
Related
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.
I have three pages with the same content, in different languages.
http://example.com/en/elephant
http://example.com/nl/elephant
http://example.com/de/elephant
When someone presses the share/like button on the dutch (nl) version I expect that the like is being shared with the english and german version.
I have set the og:url to the english version (I guess I do have to pick a version).
But the problem I now have is that the Facebook scraper looks at the english version for meta tags. So people see an English title/description when they share the dutch version.
According to the the Facebook documentation I can take a look at the X-Facebook-Locale header to serve the meta tags in the right language. But than I should serve an English page with Dutch meta tags to the Facebook crawler.
Not only is this taunting my OCD, but it also makes the code more complicated. Because the meta tags are set at different points in the request pipeline, I have multiple places where I have to switch between Cultures.
Another approach I was thinking about, is to see if there is an X-Facebook-Locale header and then do a redirect to the appropriate language, but for some strange reason that also doesn't seem to work.
What to do?
If the Facebook crawler comes to you with a X-Facebook-Locale header, then you should indeed pass it the localized OG tags. But be sure to keep one common URL.
How we (will) solve this on our site:
http://example.com/elephant is a "neutral" URL, and redirects to the /en, /nl or /de version based on the user session, or browser language preferences.
All language-specific URLs have this neutral URL in their og:url. This is the object that gets saved in the graph.
If Facebook comes to us with a X-Facebook-Locale header, we serve the same content (whether it is at /en, /nl or /de), but with the relevant tags localized.
As per the GWT docs, there are two ways two internationalize my GWT app. One is, declare the language in the HTML itself (hardcoding) through meta tags, another is to use a query param in the URL (like &locale=de).
My webapp is dynamic,different users from different locales will be using it, so the first option is not viable. The 2nd option is fine, but somehow, appending query params to a URL is my pet peeve. I tried to make it dynamic by doing something like $("head).append("<meta name='gwt:property' content='locale=de'>"); first thing on onModuleLoad, it doesn't work.
My app will actually be a redirection, some other web-page will contain a redirection like foo.com&locale=de. Based on that, it will load the required locale fine. But after that, I want to reload it again without showing the query param in the URL, taking the locale information from cookies which can be set in the first load. Is it possible to do so?
There is a third option using cookie.
Reference - GWT Internationalization for dynamically generated content
Ensure you set locale value to the cookie or have a default value for your cookie before user chooses his locale. In our case user chooses a language before login ( where i set the cookie locale value for the user) and read this into the gwt application on load.
Adding the parameter to a model (in a Controller) and picking it up on the client (in a *.jsp) will work for you?
<meta name="gwt:property" content="locale=${locale}">
Then you just need to refresh the page and reset the locale value in a controller. Add the meta-tag code in your html/jsp page, it should be there prior to page loading.
onModuleLoad works with code already loaded to the browser window, so appending meta after loading will not work.
I have seen when you visit a profile on FB and click on link provided in
Contact Information --> Website
Facebook first take you to url format mentioned below
http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.nwaonfire.com%2F&h=BAQByDCFo
and then takes you to the site .
My question is why facebook does so, Iam asking because there is a place in my application where iam allowing users to enter website urls.
...and the reason for facebook using the mentioned link instead of linking directly to http://www.nwaonfire.com is that facebook is evil.
They want to know which links are popular, where their users are going and where the link came from.
I also see a format as http://www.facebook.com/l/BAQByDCFo/www.nwaonfire.com where the BAQByDCFo is a hash value.
URL encoding is done so that a second URL can be placed within the first's query string without breaking the original URL. For example, implying directory structure by using the "/" character or breaking out of name value pair by using "&". If you're going to be embedding a URL as a query string parameter, you must encode it first. How you do this will differ depending on the language you're working with but most web based frameworks have a native or library based function to easily do this.
I searched Facebook's documentation, but could find it. In what language are the locations (for example, for checkins) returned in the Facebook API? In the application's language, in the current user's language, in the original language or in the local language?
How can I be sure that the locations are always returned in, lets say, English?
So Roma is returned as Rome, Praha as Prague and so on.
I don't think this is possible:
Editing a Place page on facebook.com doesn't present any internationalisation options
The Translations app seems geared towards translating Facebook's static content from English into other languages, rather than translating user-generated content into arbitrary languages
The only column of the FQL place table which is affected by the request locale parameter is display_subtext (example)
The only attribute of the Graph API user/checkins connection affected by the request locale parameter is application.name (example)
I think you're limited to whatever language(s) the Place creator/editors have used.