Weird Content of Facebook share/like button preview from angular app - angularjs

I have an issue with share/like button from Angular app. I finally made it working correctly with links but share/like preview if completely wrong. I tried XFBML.parse(), switching to html 5 mode, etc.
There are two complete enigmas:
1. I got "Given URL is not allowed by the Application configuration..." despite adding all possible variants to fb app setting.
When share preview appear - it has "Angular", but I never added it anywhere.
Here is the link
Would be grateful for any ideas...
Thx

The Facebook Scraper only looks at the HTML code your server delivers, it does not execute any JavaScript.
So if you want to share different articles, you need an individual URL for each article, that delivers the relevant meta data when requested from the server.
You can find some more explanation and hints on how to implement this in this article, http://www.michaelbromley.co.uk/blog/171/enable-rich-social-sharing-in-your-angularjs-app

Related

How to modify HTMLElement in index.html before page gets returned to requestor

Based on my custom URL parameters I process, I am trying to modify dynamically a meta tag I have id'ed in index.html like so:
<meta name="og:image" content="http://example.com/someurl.jpg" id="ogImage"/>
The code below in my home.ts seems to be working
document.getElementById('ogImage').setAttribute("content", Media.ImageURL) ;
I can verify it is via the browser dev console/elements.
However, when I view from facebook via their ojbect graph debugger at
https://developers.facebook.com/tools/debug/og/object/
It appears to see the default
http://example.com/someurl.jpg
as if the index.html is shipped before my home.ts gets chance to make the update.
Perhaps, my understanding is flawed and there is better way to do this.
Thank you.
Note1: initially, I was thinking I had to make some angular binding between index.html and one of my services but I could not locate any sample code, the closest I came to was this post
How can I update meta tags in AngularJS?
But I don't know how to apply it for my ionic2/3 code, so I opted for the document.get approach.
Note2: the ultimate goal here is to share a link into a social media (web or app) like facebook, a messenger like viber/skype, etc... and have it resolve to meaningful images, title, description to drive the visit back to the site via browser, or app if the user clicking on the link is on a mobile device with my app version of the site installed on his device.
Note3: if you decide to point me to ionic deeplinking please provide code to match above, because I could not understand how to apply to my case.
If you are trying to implement dynamic open graph meta tags values in your pages, you will need a server-side scripting language like php. Such a script will run on the server, update the pages as needed, then the pages will be served to the requesting site or application.
client-side scripting (ie. JavaScript) is usually ignored when a site or app is merely visiting your site/link for the purpose of extracting (aka scrapping, parsing html) information such as the one provided by the open graph meta tags (og:title, og:description og:image...).

AngularJS application problems appearance in Google search

I have a personal project which consumes my free time and effort for about a year without significant profit. I have problems with it appearance in Google and would really appreciate to get help here.
This project (http://yuppi.com.ua - similar to craiglist in US) is WEB-based AngularJS 1.2 application that uses PHP rest API hosted on GoDaddy. And in order to make this application popular it have to be very visible in internet and very searchable in Google and users have to be able to share pages via social networks or skype.
According to Google specification, google crawlers doesn't run javascript to get content of a web page before index, so I've added _escaped_fragment_ page that displays content of web page without javascript. For example:
Page: http://yuppi.com.ua/#!/items/sub/18/_
Dirty : yuppi.com.ua/?_escaped_fragment_=/items/sub/18/_
This dirty page will be redirected here where google will see content.
http://yuppi.com.ua/server/crawler_proxy/routee.php?path=/items/sub/18/
So basically I have two versions on HTML file for that page. One version is the one that available to users, which has styles, a lot more HTML tags etc. And the second is the version for Google crawler - very light-weight without any styles. And I am expecting to see clean link to my site in Google, not dirty.
So, If to search all links to a web site in Google you will see that one of the links displays it's "dirty" state.
Another problem is sharing links in Skype.
When I send a link to someone, I am expecting that this link will be transformed to thumbnail image but it is not happens. Instead I see ungly link to my web site.
Please help me to understand how to make happy everyone: users, google crawler, GoDaddy and me.
I was encountering the same problems last year with a big project and we ended to use : https://prerender.io/.
It's a prerendering system that work with a phantomjs browser to detect bot request and render a full html template. It does also instanciate a cache service to not render again a template that haven't change.
Hope it help's.

Mobile Viewing for Google Apps Script with Bootstrap

I am trying to design a mobile first web app using Google Apps Script.
I would try to replicate the most basic Bootstrap page (http://getbootstrap.com/examples/navbar) in a Google Apps Script.
This is the way the bootstrap page should render on my mobile device:
but instead my page loads like this (ie. http://goo.gl/yZpgUg):
This is my code.gs:
function doGet() {
return HtmlService
.createTemplateFromFile('index')
.evaluate()
.setSandboxMode(HtmlService.SandboxMode.NATIVE);
}
My index.html is copied and pasted from http://getbootstrap.com/examples/navbar with CDNs replaced as appropriate.
I figured HtmlService.SandboxMode.NATIVE was important to get this to work but doesn't seem to work.
Dear world - any help would be greatly appreciated.
Cheers.
UPDATE 1 - (THANKS FOR YOUR RESPONSES!)
in IFRAME:
IFRAME console errors (2):
NATIVE console errors (lots):
Bottom line - clearly GAS is not liking it and doesn't seem super straight forward - I've ended up turning the GAS into an API which returns JSONP from the spreadsheet I need - much more straight forward. Thank you for all your help!
I know you decided to go another route, but I got this to work in the same scenario. You can simply add the meta tag on the GAS code using the following code:
var output = HtmlService.createHtmlOutput('Hello, world!');
output.addMetaTag('viewport', 'width=device-width, initial-scale=1');
So when you serve up your html in doGet add the meta tag. Check out this link for more information: https://developers.google.com/apps-script/reference/html/html-output#addMetaTag(String,String)
Apparently Google can't load Bootstrap from their server, try copying everything to GAS and include in the page as explained in best practices. Also switch back to IFRAME when testing.

Integrating kibana dashboards into an angularjs app

I have my ElasticSearch setup with kibana showing different panels. I have another angularjs app. I would like to receive input in a field, use angularjs and show kibana panels in my angularjs app itself.
Are there any tutorials/guides to achieve this?
I have googled quite a bit about this, but am unable to find any help.
You could also rephrase my question as "How do I embed a kibana dashboard in my AngularJS Single page website?"
In kibana4, the easiest way to embed a dashboard is using an iframe. Click the "Share" button in the top-right corner to get the appropriate iframe tag. Then edit it as needed to make it embed seamlessly. Check out the seamless attribute.
When I google it your question, I have found some git article
May be it will help you to
You can use iframe read this
https://github.com/elastic/kibana/issues/729

Checkboxes disappearing when uploading to Google App Engine

I have written a controller to take input from the form containing a list of options. The options have to be selected using checkboxes. I have successfully tested the code on my local machine. But when uploaded to the app engine, the webpage is not displaying the checkbox fields. It is not displaying the options either. I tested with 3 browsers - IE, Mozilla and Chrome and this happens everywhere. But, everything is working on fine on the browsers when running on local machine. I am quite confused as to what is going wrong.
Please help me fix this issue.
Thanks in advance...
You likely need to setup static file/directory mappings in app.yaml.
You need to provide us with more details to help you debug issues. For example, if the browser doesn't display what you expect tell us what it does display. What happens if you view source? Is your HTML there?

Resources