在社交媒体上分享闪亮的应用程序时如何控制社交分享图像和文本(部署 shinyapps.io)

How to control social share image and text when sharing shiny apps on social media (deployed with shinyapps.io)

当我在社交媒体上分享我的 shinyapp 时,代码显示在 header 图片下方,看起来不太好。如何控制 shinyapp 的社交分享图片和文字?我已经使用 shinyapps.io.

部署了该应用程序

示例见下图:

Link 应用:https://regionalinnovationdatalab.shinyapps.io/Dashboard/

Link到Gitlab,可以找到App代码和数据:https://gitlab.com/r.chappell/2019_ElectionApp_RIDL

来自 UI 的代码,其中插入了 header 图片:

     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(),  

在寻求 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 说他们正在处理这个问题,但这是目前的解决方案。