rmarkdown icon indicating copy to clipboard operation
rmarkdown copied to clipboard

shiny prerendered website does not render html according to route

Open schloerke opened this issue 5 years ago • 4 comments

By filing an issue to this repo, I promise that

  • [x] I have fully read the issue guide at https://yihui.name/issue/.
  • [x] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

❯❯ xfun::session_info('rmarkdown')
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.4

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  base64enc_0.1.3  digest_0.6.18    evaluate_0.13    glue_1.3.1      
  graphics_3.5.3   grDevices_3.5.3  highr_0.8        htmltools_0.3.6 
  jsonlite_1.6     knitr_1.22       magrittr_1.5     markdown_0.9    
  methods_3.5.3    mime_0.6         Rcpp_1.0.1       rmarkdown_1.12.6
  stats_3.5.3      stringi_1.4.3    stringr_1.4.0    tinytex_0.12    
  tools_3.5.3      utils_3.5.3      xfun_0.6         yaml_2.2.0      

Pandoc version: 2.2.1

Community Link: https://community.rstudio.com/t/rmarkdown-website-using-shiny-prerendered-documents/29333

Since rmarkdown::run() targets index.Rmd by default, this is the page that will remain displayed no matter which Rmd file is targeted in the URL.

Reprex Repo: https://github.com/hugo-pa/shiny_website_example

Issue line: https://github.com/rstudio/rmarkdown/blob/992381196324b69976c73808eb9e9b73922716ef/R/shiny_prerendered.R#L52-L58

The line above is returning the original html content for the original shiny prerendered file. This does not adapt to multiple route locations that uiPattern accepts.

I don't know of a direct solution right now as ui, server, and onStart are very connected but separate arguments.

schloerke avatar Apr 29 '19 14:04 schloerke

Very interested in this issue. If this can be resolved I assume you then easily embed various learnr documents in a larger Rmarkdown website right?

@hugo-pa In case you haven't found an alternative solution yet ... I created a demo shiny app a few years ago with multiple pages/documents rendered using knitr (link below). Pages can have shiny components, quizzes, etc. and the page only needs to be rendered when you first visit (i.e., no re-rendering). It works well, but perhaps shiny_prerendered could still be faster?

https://github.com/vnijs/shiny-site

vnijs avatar Apr 12 '20 04:04 vnijs

I run into the same issue as @hugo-pa and @schloerke originally elaborated, trying to switch from a working website with runtime:shiny to runtime:shiny_prerendered. Has there been update to resolve this issue? It would be quite nice to use the shiny_prerendered version on multipage website.

xiangnandang avatar Jun 01 '20 03:06 xiangnandang

Just checking in on the status of this issue. Have run into this a few times now. The prerendered runtime is pretty amazing and would love to be able to include it as part of an entire rmarkdown website.

mrworthington avatar Jan 08 '21 16:01 mrworthington

Any updates on this? Seems like a whole community of learnr champions are waiting to build amazing learning portals when this is solved.

matthewhirschey avatar Jun 02 '22 19:06 matthewhirschey