在社交媒体上共享有光泽的应用程序时如何控制社交共享图像和文本(与shinyapps.io部署)

时间:2019-03-26 02:01:24

标签: r shiny shinyapps

当我在社交媒体上共享我的Shinyapp时,代码显示在标题图像下,看起来不太好。如何控制我的Shinyapp的社交共享图像和文本?我已经使用Shinyapps.io部署了该应用程序。

请参见下图作为示例:

enter image description here

链接到应用:https://regionalinnovationdatalab.shinyapps.io/Dashboard/

链接到可在其中找到应用程序代码和数据的Gitlab:https://gitlab.com/r.chappell/2019_ElectionApp_RIDL

插入标题图像的UI代码:

     ui <- shiny::fluidPage( #use fluid page so that the app adjusts to the user's screen size and device

    titlePanel(div(img(src='DATA DASHBOARD V3.png', height = 80))), #header title with image as the whole header ( must save header image in a subfolder titled 'www')
  tags$head(tags$style(
    type="text/css",
        "img {max-width: 100%; width: 100%; height: auto}" #makes image size responsive to device and screen
    )),
    theme = "journal", #selected theme from shinythemes package
   title=" RIDL: 2019 Election App", #title of web brower tab
    br(),  

1 个答案:

答案 0 :(得分:0)

在寻求R Studio支持的帮助后,他们说将Java脚本代码发布到Shinyapps.io时出现问题,这就是为什么它不起作用的原因。

我最终找到了解决方法。

我更改了此代码:

 ui <- shiny::fluidPage( #use fluid page so that the app adjusts to the user's screen size and device

    titlePanel(div(img(src='DATA DASHBOARD V3.png', height = 80))), #header title with image as the whole header ( must save header image in a subfolder titled 'www')
  tags$head(tags$style(
    type="text/css",
        "img {max-width: 100%; width: 100%; height: auto}" #makes image size responsive to device and screen
    )),

对此:

  ui<-shiny::fluidPage(
    titlePanel(div(img(src='DATA_DASHBOARD_V3.png', height = "auto", width = "100%")))),

此代码删除了以前出现的Java脚本代码,但与Facebook共享时不包含缩略图。 R Studio说他们正在解决这个问题,但这是目前的解决方案。

enter image description here