Search code examples
shinygolem

Modify the title of the shiny application in golem in the tab of the web browser


I am developing a shiny application using golem as framework. I noticed that when I run the application, the browser page tab shows the name of the package defined in '01_start.R' (e.g. pkg_name = "golem.test").

I have tried to include this code in the ui but it doesn't work:

app_ui <- function(request) {
  # ...
  tags$head(tags$title("My New Title"))
  # ...
}

But it doesn't work. It still shows "golem.test".

How and where can I change the title of the application so that it is displayed correctly in the tab?.

Thank you very much.
Wardiam


Solution

  • In the app_ui file, there should be a golem_add_external_resource function. It is in this function that we can change the name of the application tab, the favicon etc...

    Your app_ui may look like this :

    app_ui <- function(request) {
      tagList(
        #Leave this function for adding external resources
        golem_add_external_resources()
      )
    }
    
    golem_add_external_resources <- function(){
      tags$head(
        bundle_resources(
        #Change the title of the application here
          app_title = "My new Title"
        )
      )
    }