Publish Quarto Dashboard
Prompt: Is there a way to use shinylive to publish demo.qmd (demo.html) as a static file much as we did with the shiny app?
Response: No, you cannot directly export a standard server: shiny Quarto Dashboard (which uses markdown sections for the layout and separates the server code in #| context: server blocks) using shinylive::export.
Here is why, and how you can achieve a static Shinylive version of the dashboard. [The advice would work for a much simpler app. It did not work in this case.]
Why a standard Shiny Quarto Dashboard cannot be exported directly
- Server dependency: Standard Quarto dashboards with
server: shinyrely on a running backend R session (like Posit Connect or Shiny Server) to sync the inputs/outputs spread throughout the document. - Shinylive’s “Standalone” requirement: When using Shinylive in Quarto, the entire Shiny application (both UI and Server logic) must be self-contained inside a single code block defined as
#| standalone: true. You cannot distribute widgets across different markdown headings/sidebar columns.
How to publish it statically with Shinylive
If you want a serverless, static version of this dashboard, you have two options:
Option A: Use the R Shiny App (Already Done)
The Shiny application in inst/connect_modules/app.R already contains the same plots and logic as demo.qmd.
- Because it is a standard Shiny app, it is fully compatible with
shinylive::export(). - It is already successfully exported as a serverless, static app in your
docs/shiny/directory.
Option B: Embed a Shinylive App inside a Quarto Document
If you specifically want a .qmd document that compiles to a static page containing the interactive dashboard, you can embed the R code inside a {shinylive-r} block:
-
Install the Shinylive Quarto Extension (locally in your terminal):
quarto add quarto-ext/shinylive -
Create a new
.qmdfile (e.g.docs/demo_shinylive.qmd) with theshinylivefilter:--- title: "Geyser Dashboard (Static)" format: html filters: - shinylive --- -
Embed the code in a single standalone block:
```{shinylive-r} #| standalone: true #| viewerHeight: 700 # Paste the loading helper, ui structure, and server logic here # (e.g. your source code from inst/connect_modules/app.R)```
-
Render it: When you run
quarto render docs/demo_shinylive.qmd, it will compile into a serverless interactive HTML page that runs entirely in the browser and can be served statically on GitHub Pages.
Walkthrough: Option B Implementation
I have implemented and automated Option B to host a serverless, interactive Quarto dashboard on GitHub Pages:
1. Installed Quarto Shinylive Extension
Installed the extension in the repository:
quarto add quarto-ext/shinylive --no-prompt
2. Created Self-Contained Shinylive Document
Created docs/demo_shinylive.qmd. It is structured to run completely in the browser via WebAssembly:
- YAML Header: Configured format as
htmland registered theshinylivefilter. Explicitly specifiedengine: knitrto bypass Jupyter/Python kernel execution checks (avoiding errors likeModuleNotFoundError: No module named 'nbformat'). - Code Chunk: Set
#| standalone: trueand concatenated all the R modules (from the rootR/directory) and the navbar UI layout (fromapp.R) inside a single{shinylive-r}code block.
3. Integrated into CI/CD Deployment Workflow
Updated .github/workflows/deploy.yml to automate the build-and-deploy process on GitHub Actions:
- Installs
shinylive,knitr, andrmarkdownR packages inside the runner. - Installs the Quarto Shinylive extension inside the GitHub Actions runner.
- Renders
docs/demo_shinylive.qmdusingquarto render docs/demo_shinylive.qmd. - Deploys the output
docs/demo_shinylive.html(along with the other pages in thedocs/folder) directly to GitHub Pages.
This avoids local rendering Deno cache errors, bypasses unnecessary Jupyter python dependencies, and automates updates every time you push to the main or master branch.