Paul Schmidt
Paul Schmidt

Reputation: 1209

Links between pages in quarto website with qmd files in different subfolders

I am creating a website with quarto (using RStudio). I want to have links between pages on my site, which usually works as described here in the quarto documentation. However, I have saved the .qmd files for my pages within separate subfolders within the project directory as shown in this example _quarto.yml:

website:
  title: "Main Title"
  navbar:
    title: "Navbar Title"
    left:
      - text: Pages
        menu:
          - text: Page A
            href: folderA/pageA.qmd
          - text: Page B
            href: folderB/pageB.qmd

When trying to add [link](folderB/pageB.qmd) anywhere within the pageA.qmd document, it incorrectly creates the link as folderA/folderB/pageB.qmd which obviously does not work.

How do I correctly assign links between pages in this setting?

Upvotes: 7

Views: 6149

Answers (1)

AlbertRapp
AlbertRapp

Reputation: 478

It's a bit tedious but you should be able to use relative paths, i.e. .. to move to previous directory.

So in your case that would be [Link](../folderB/pageB.qmd). Not a great solution but as long as your directory structure stays the same, it should work.

If you later on find yourself changing the structure you can use aliases to keep the old links alive.

Upvotes: 8

Related Questions