Andrea Dalla Rosa
Andrea Dalla Rosa

Reputation: 119

Html output takes too long to load

I have this html knit output from Rmarkdown but since it is pretty heavy (it is an online guide), the page takes too long to show up when opening the link. I tried to divide the rmd file into distinct rms sub files as below shown but I still can't get the result. Thank you

title: "my_file"
author: "me"
date: "26/02/2020"
output:
  html_document:
    toc: yes
    toc_depth: 3
    toc_float:
      collapsed: yes
      smooth_scroll: yes
  word_document: default
---


```{r child = 'child0.Rmd'}
```

```{r child = 'child1.Rmd'}
```

```{r child = 'child2.Rmd'}
```

```{r child = 'child3.Rmd'}
```

```{r child = 'child4.Rmd'}
```

Upvotes: 1

Views: 2855

Answers (1)

user2554330
user2554330

Reputation: 44867

Probably the best way to speed things up is to break up your web site into multiple pages. You can use the blogdown package to support this, but for a first try, it's even easier to use an RStudio site generator. Here are the steps:

  1. Create a new RStudio project; choose "Simple R Markdown website" for the type of project. This automatically creates three files, _site.yml, about.Rmd, index.Rmd.

  2. Decide how you want to break up the files into separate pages, and create .Rmd files for each one. The headers should be similar to the ones in about.Rmd and index.Rmd, and you should add lines to _site.yml for each page.

  3. Click on "Build website" in the Build pane (usually top right in RStudio). This will process all of the files and open the website at the index page.

The HTML files will be stored in the _site folder within your project; you can copy them from there to your web server.

Upvotes: 1

Related Questions