Quarto multi language book

I needed to create a multi language book website.

I have used information from following posts to create my own solution.

I have used quarto project profiles and navigation bar for this purpose.

I have three profiles

  • def (for default)
  • tr (Turkish language version)
  • en (English language version)

def profile is only used for main index.html page and redirection to English and Turkish main pages. You can see the important parts of the quarto.yml below. I removed unimportant parts in the below quarto.yml file. You could see original file here.

Below Index.qmd file contains two links for going to English or Turkish versions.

project:
  type: book
  output-dir: ./_site

book:
  chapters:
      - index.qmd

In the other two profiles, we render in two different directories using output-dir property. Then using navbar, we could switch between the sites.

quarto-tr.yml

project:
  output-dir: ./_site/tr
book:
  title: "Veritabanlarına Giriş"
  navbar:
    background: primary
    search: true
    right:
      - text: "English"
        href: ../en/index.html
      - text: "Türkçe"
        href: ../tr/index.html

quarto-en.yml

project:
  output-dir: ./_site/en

book:
  title: "Introduction to databases"
  navbar:
    background: primary
    search: true
    right:
      - text: "English"
        href: ../en/index.html
      - text: "Türkçe"
        href: ../tr/index.html

To be able to render all of the profiles, we render three times like below.

quarto render --to html --profile def
quarto render --to html --profile en
quarto render --to html --profile tr

In the github pages, above commands is repeated using following yml.

      - name: Render Quarto Project Profile Def
        uses: quarto-dev/quarto-actions/render@v2
        env:
          QUARTO_PROFILE: def
        with:
          to: html 

See github workflow yaml file and working site.