Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom favicon is not displayed #296

Open
ghost opened this issue Jun 26, 2024 · 2 comments
Open

Custom favicon is not displayed #296

ghost opened this issue Jun 26, 2024 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 26, 2024

This block here seems wrong. It is doing the same thing in both cases.

dashR/R/dash.R

Lines 1897 to 1905 in d281e70

# create tag for favicon, if present
# other_files_map[names(other_files_map) %in% "/favicon.ico"]
if ("/favicon.ico" %in% names(private$asset_map$other)) {
favicon_url <- sprintf('\"%s_favicon.ico\"', self$config$requests_pathname_prefix)
favicon <- sprintf("<link href=%s rel=\"icon\" type=\"image/x-icon\">", favicon_url)
} else {
favicon_url <- sprintf('\"%s_favicon.ico\"', self$config$requests_pathname_prefix)
favicon <- sprintf("<link href=%s rel=\"icon\" type=\"image/x-icon\">", favicon_url)
}

@ghost
Copy link
Author

ghost commented Jun 26, 2024

Also see #297. A workaround:

app_title <- "My app"
app_custom_index <- local({
  template <- app$.__enclos_env__$private$template_index[[1]]
  template <- sub("{%favicon%}",
                  "<link href=\"assets/favicon.svg\" rel=\"icon\" type=\"image/x-icon\">",
                  template, fixed = TRUE)
  template <- sub("{%title%}", app_title, template, fixed = TRUE)
  return(template)
})
app$index_string(app_custom_index)

@rpkyle
Copy link
Contributor

rpkyle commented Jun 26, 2024

This block here seems wrong. It is doing the same thing in both cases.

dashR/R/dash.R

Lines 1897 to 1905 in d281e70

# create tag for favicon, if present
# other_files_map[names(other_files_map) %in% "/favicon.ico"]
if ("/favicon.ico" %in% names(private$asset_map$other)) {
favicon_url <- sprintf('\"%s_favicon.ico\"', self$config$requests_pathname_prefix)
favicon <- sprintf("<link href=%s rel=\"icon\" type=\"image/x-icon\">", favicon_url)
} else {
favicon_url <- sprintf('\"%s_favicon.ico\"', self$config$requests_pathname_prefix)
favicon <- sprintf("<link href=%s rel=\"icon\" type=\"image/x-icon\">", favicon_url)
}

Anecdotally, I suspect you are correct @sid-bagaria. It's been a long time since I worked on this project, but if I recall the original else set favicon to NULL, and this was later modified to store an empty string if no valid favicon was passed.

I'm not sure whether this is copypasta, but it seems possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant