Search code examples
htmlrshinyshinydashboard

Write shiny$HTML(...) without tags$head(...) in Shiny


How can I write this below just using shiny$HTML to the code instead of tags$head(shiny$HTML(...)?

Ex:

tags$head(
HTML("<title> Dashboard</title>
<link rel='shortcut icon' href='www/lll.png'></link>
<link rel='stylesheet' href='www/shiny.css'></link>
     <script src='www/shiny.js'></script>"
     )
)

works.

I insert the <head> tag without tags$head:

HTML("<head>
<title> Dashboard</title>
<link rel='shortcut icon' href='www/hell.png'></link>
<link rel='stylesheet' href='www/shiny.css'></link>
     <script src='www/shiny.js'></script>
</head>"
     )

doesn't work.

I want to use shiny$HTML tags, just, pure, without tags$head. It's possible?

simple shinyApp:

library(shiny)
library(shinydashboard)

h <- dashboardHeader(title = "a")

s <- dashboardSidebar()

b <- dashboardBody()

ui <- dashboardPage(h, s, b, skin = "blue")

server <- function(input, output) {

}

shinyApp(ui, server)

Solution

  • This is working fine:

    library(shiny)
    library(shinydashboard)
    
    ui <- dashboardPage(
      dashboardHeader(),
      dashboardSidebar(),
      dashboardBody(
        HTML("<head>
                <title>Hell Tattoo Dashboard</title>
              </head>"
        )
      )
    )
    
    server <- function(input, output, session) {}
    
    shinyApp(ui, server)
    

    result