【问题标题】:How to control social share image and text when sharing shiny apps on social media (deployed with shinyapps.io)在社交媒体上分享闪亮的应用程序时如何控制社交分享图像和文本(使用 shinyapps.io 部署)
【发布时间】:2019-03-26 02:01:23
【问题描述】:

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

以下图为例:

应用链接: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(),  

【问题讨论】:

    标签: r shiny shinyapps


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-24
      相关资源
      最近更新 更多