r - 在社交媒体上分享闪亮的应用程序时如何控制社交分享图像和文本(使用 shinyapps.io 部署)
问题描述
当我在社交媒体上分享我的 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 工作室支持的帮助后,他们说 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 表示他们正在解决这个问题,但目前这是一个解决方案。
推荐阅读
- multithreading - 如何在一个线程中更新并从多个线程中读取?
- reactjs - 将 Id 属性添加到多个复选框
- php - 从 Laravel 上的表中获取数据的最快方法
- r - 如何在忽略R中的值的同时对df求和?
- django - 在 Django update-view 实例中没有预先填写表单
- postgresql - 显示在另一个表中只有一个匹配行的记录
- android - 基于 Android API 级别有条件地声明依赖项 - Gradle
- java - 单击“收藏夹”按钮时停止recyclerview尝试更新
- java - SceneBuilder 无法创建具有给定属性集的自定义组件的实例
- excel - Excel:在多个 ID 中按日期排序