r-markdownrstudio-connectposit-connect

How to link to local html files in posit connect


How do I specify the path to a local html file in posit connect? The following code gives me a 404 error when I click on the link to "main.html" but the image and external links both work. I would like to have "main.html" in a child folder but I loved it to the root hoping it would help (but it did not).

---
output: html_document
resource_files:
- main.html
---

[parsnip](https://parsnip.tidymodels.org/index.html)

[main](main.html)

![logo](logo.png)

I have specified that the png and html files be uploaded.


Solution

  • Posit sent me a link with the answer: https://docs.posit.co/connect/user/rmarkdown/#r-markdown-resource-files

    In addition to the code above I needed to add:

    rmd_output_metadata:
      rsc_output_files:
        - "main.html"
    

    The link above currently says that relative paths are not allowed. That is not true. You can use relative paths but you can only point to files that are in the current folder/directory or child folders/directories. In other words, avoid ../ .