babylinguist
babylinguist

Reputation: 414

Use Rmd files for content pages in blogdown website

I am considering switching my website to blogdown. My current set-up only uses .Rmd files with a less-than-ideal blog implementation. It seems like one advantage of blogdown is that it automates the blogging part of the website (posts, lists, dates, etc.) and allows RMarkdown. This is my main motivation to switch. However, the downside, I think, is that I cannot create content pages in RMarkdown (i.e., content > about.Rmd)... it seems this is limited to .md files. I would like to use .Rmd for all the pages so that I can incorporate r code. My question: Is it possible to create .Rmd content pages in blogdown?

EDIT... Specifically, I created by hand research.Rmd in the content folder. I can include a trivial example, such as...

`r 2 + 2`

and when I run serve_site() the r code is not rendered. I can knit the file by hand, but the file does not have the style of the theme I am using and once I again try to serve the site the file is rendered as if it were a .md file. ```

EDIT 2...

You can reproduce the behavior I am referring to by doing the following...

  1. Create a new blowdown site: new_site(dir = ".", theme = 'gcushen/hugo-academic')
  2. Create new content: new_content('test/index.Rmd')
  3. Set draft to false and add trivial r code: I used 2 + 2 as shown above.
  4. Serve site and go to test/index.html. There is no r code rendered.

Upvotes: 3

Views: 392

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30194

From your Edit 2, you seem to have fallen into a common Hugo trap: content/test/index.Rmd does not necessarily generate test/index.html. Hugo uses the convention _index.md to generate a homepage for a subfolder, and you have to use content/test/_index.Rmd in your case. For content/about.Rmd or content/research.Rmd, they will generate about/index.html and research/index.html respectively by default.

Upvotes: 2

Related Questions