如何在我的 R Shiny 应用程序中包含元标记?

jul*_*lio 3 r meta-tags shiny

我尝试添加以下内容,但发布的应用程序似乎不包含我的元标记。源代码显示 head 标签内的东西似乎是默认内容。我想让我的应用程序可搜索。

tags$head(
  tags$meta(charset="UTF-8"),
  tags$meta(name="description", content="..."),
  tags$meta(name="keywords", content="..."),
  tags$meta(name="viewport", content="width=device-width, initial-scale=1.0")
)

ui<-fluidPage(...)
Run Code Online (Sandbox Code Playgroud)

MrF*_*ick 7

只要确保你包括meta标签fluidPage对象。Shiny 会将 中的所有标签拉出head到适当的位置。

ui<-fluidPage(
  tags$head(
    tags$meta(charset="UTF-8"),
    tags$meta(name="description", content="..."),
    tags$meta(name="keywords", content="..."),
    tags$meta(name="viewport", content="width=device-width, initial-scale=1.0")
  ), ...)
Run Code Online (Sandbox Code Playgroud)