0

I am experimenting with quarto to see how I can create a website. These are the steps that I have followed so far:

  1. Open RStudio (RStudio Server 2022.02.0 Build 443)
  2. Go to File > New Project... > New Directory > Quarto Website > type Directory name: > Create Project
  3. Go to Build > Render Website

This works fine! However, when I try to add a section for blog, the website doesn't compile correctly. Here's what I did:

  1. Create a blog folder under root
  2. Create a file blog/index.qmd
  3. Create a blog/posts folder
  4. Create a blog/posts/test-post folder
  5. Add files index.qmd and featured.jpg to blog/posts/test-post folder

Run this code in R console to add featured.jpg file:

download.file(
  "https://upload.wikimedia.org/wikipedia/commons/3/3f/August_Macke_-_Three_girls_in_yellow_straw_hats_I_-_Google_Art_Project.jpg", 
  "blog/posts/test-post/featured.jpg"
)

Here are the contents of the blog/index.qmd file:

---
title: This is my blog.
listing:
  contents: posts
  type: default
---

Here are the contents of the blog/posts/test-post/index.qmd file:

---
title: My first blog post.
image: featured.jpg
---

Here are the contents of the _quarto.yml file:

project:
  type: website

website:
  title: "test-quarto-web"
  navbar:
    background: primary
    left:
      - href: index.qmd
        text: Home
      - about.qmd
      - href: blog/index.qmd
        text: Blog

format:
  html:
    theme: cosmo
    css: styles.css

editor: visual

After I render the website and click on the Blog menu, this is what I see:

enter image description here

How can I fix this issue? I believe there is some problem with the file path, but I couldn't figure out how to fix this!

user2554330
  • 37,248
  • 4
  • 43
  • 90
Ashirwad
  • 1,890
  • 1
  • 12
  • 14
  • 1
    I don't see any R programming in this question. – user2554330 Jul 08 '22 at 21:57
  • I replicated your file structure and it worked for me (I'm using VS Code, not RStudio). Do you know your Quarto version? Running `quarto --version` tells me that my version is 0.9.647. – Lucas A. Meyer Jul 09 '22 at 17:31
  • Running `quarto --version` in the terminal returns `bash: quarto: command not found`! This is what I found on the quarto website: "Alternatively, there is a version of Quarto built-in to RStudio that you can activate from R Markdown Preferences." I used this feature. I didn't install quarto myself. How can I check the version of quarto that comes bundled with RStudio? – Ashirwad Jul 09 '22 at 19:35
  • I couldn't find a way to get the version used in RStudio, but I copied your directory structure to my RStudio installation (version 2022.07 build 548) and the post and image also appared. – Lucas A. Meyer Jul 09 '22 at 19:54
  • Just want to be sure that I'm using the correct directory structure: `project_root (contains _quarto.yml, .gitignore, about.qmd, [blog], x.Rproj, index.qmd, styles.css)`, then `blog (contains index.qmd and [posts])`, then `posts (contains [test-post])`, then `test-post (contains featured.jpg and index.qmd)` The listings file is the index.qmd inside the `[blog]` directory. – Lucas A. Meyer Jul 09 '22 at 19:58
  • Huh, that's interesting! I see that you are using version 2022.07, but in my case it's 2022.02. If possible, can you try using the previous RStudio version and see if you can reproduce my problem? Also, you are right about the folder structure. – Ashirwad Jul 09 '22 at 20:05
  • I am using the docker image with Google Cloud, so updating RStudio server doesn't seem like an option (at least not yet!). As I understand it, updating quarto might fix this problem. If I install quarto, will it interfere with the quarto version that comes bundled with RStudio and lead to more problems? Just curious. – Ashirwad Jul 09 '22 at 20:09
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/246303/discussion-between-ashirwad-and-lucas-a-meyer). – Ashirwad Jul 09 '22 at 20:15

1 Answers1

1

In my experience, this is frequently due to using an old version of Quarto. As Quarto is nearing release, there are improvements happening daily.

To install the latest version from Quarto, follow the instructions here. Use the "Latest Quarto version" tab.

If you install a new version, RStudio Desktop will recognize it.

Lucas A. Meyer
  • 428
  • 3
  • 8