gadenbuie / metathis

:information_source: <meta> tags and social media cards for R-made web things
https://pkg.garrickadenbuie.com/metathis
Other
67 stars 3 forks source link

preview image not showing when deploying apps on shiyapps.io #9

Closed zhiiiyang closed 4 years ago

zhiiiyang commented 4 years ago

Hi please let me know if you need example codes for this. But I am basically copying and pasting the example from https://pkg.garrickadenbuie.com/metathis/index.html.

Here is what the preview looks like on Facebook. So, I am not sure whether it has anything to do with shinyapps.io or I did something wrong. Thank you! image

gadenbuie commented 4 years ago

Hi Zhi, thanks for opening this issue! The problem is that shinyapps.io blocks crawlers from accessing your site. This makes sense because they don't want non-human users to wake up your Shiny app and cost you money or hours, but as a side-effect the Facebook robots can't lookup your app's metadata.

I'll leave this issue open in case shinyapps.io makes this setting configurable or anyone finds a work around, other than self-hosting your Shiny apps.

zhiiiyang commented 4 years ago

I think I just found the solution. shinyMobile (https://github.com/RinteRface/shinyMobile/) allows you to add icons that can be read by crawlers even having your app deployed on shinyapps.io. Also, I just tested on my app today and it worked.

gadenbuie commented 4 years ago

Can you link to your app where it worked so I can look into this further?

zhiiiyang commented 4 years ago

@gadenbuie, sure. The link to the app is https://github.com/zhiiiyang/OTworkout. The manifest is stored in the www folder: https://github.com/zhiiiyang/OTworkout/blob/master/www/manifest.json In the following code, you can find the code where the ui reads the manifest. https://github.com/zhiiiyang/OTworkout/blob/master/app.R#L8-L11

gadenbuie commented 4 years ago

Thanks Zhi, that was helpful! On the one hand, I've realized that there's a small bug that I need to fix (#10) for OpenGraph tags (used by Facebook and others). This is definitely the root cause of some of the missing information in your app when you used metathis.

On the other hand, I've described in #11 the potential issues that may arise with apps hosted on shinyapps.io. The problem isn't necessarily resolved by using the app manifest; any website that respects shinyapps' request not to be crawled will also not display the extra information. It turns out, unsurprisingly, that Facebook is ignoring this request and scraping your app anyway.

zhiiiyang commented 4 years ago

Sorry about not being clear. Since my Shiny app was phone-based, what I was talking about is the customized icon being missing while sharing over the phone and bookmarking it in iPhone Homescreen (See below). I don't think the preview of social images works for Facebook or LinkedIn but it is fine since it is not the primary goal of my question. Thank you!

Homescreen

IMG_2477

iMessage

IMG_2478