Before we proceed…

If you’ve published your site:

Add your site-url to _quarto.yml, e.g. 

_quarto.yml
website:
  site-url: https://charlotte.quarto.pub/template-site

Let’s Add a Page!

  • Create a new page: /talks.qmd

  • Add some content

  • Preview:

    < site url >/talks.html

talks.qmd
---
title: Talks
---

{{< lipsum 1 >}}
{{< placeholder 400 400 >}}

Adding Pages

Two decisions:

  1. Structure Where will it live in your website project?
  2. Navigation How will people discover it on your website?

Structure

File path becomes URL path

File location

talks.qmd

reports/air-quality.qmd

URL

{ site url }/talks.html

{ site url }/reports/air-quality.html

index.html is special

File location

index.qmd

talks/index.qmd

URL

{ site url }

{ site url }/talks

index.qmd (or .md, or .ipynb) -> index.html

index.html acts like a default page for the site or directory.

You aren’t limited to .html

File location

data/monthly.csv

cv.pdf

reports/air-quality.qmd with format: pdf

URL

{ site url }/data/monthly.csv

{ site url }/cv.pdf

{ site url }/reports/air-quality.pdf

Structure helps …

  • You: Navigate and organize your content

  • Your readers: Understand context of content from its URL

Your Turn

Add a new page to your site:

  1. Think about the URL first
  2. Create the page file in the appropriate location
  3. Add some content
05:00

Your Turn

Provide links to your new page:

  • From somewhere in the content of index.qmd
  • Before “Home” in the navigation bar

Your Turn

  1. Customize your navigation bar title
  2. Experiment with the position of your links in the navbar: left, right or a mix
  3. Add at least one item to tools in your navbar
05:00

When things get more complicated…

Your Turn

Brainstorm with your neighbor: What elements on this page allow the user to navigate the site?

05:00

Primary Navigation

Top navigation

Side navigation

Primary Navigation

Top navigation

_quarto.yml
website:
  navbar:
    left:
      - index.qmd
      - talks.qmd
      - projects/index.qmd
    tools:
      - text: GitHub
        href: http://github.com
        icon: github        

Add items to left, right and tools

Side navigation

_quarto.yml
website:
  sidebar:
    contents:
      - index.qmd
      - talks.qmd
      - projects/index.qmd
    tools:
      - text: GitHub
        href: http://github.com
        icon: github    

Add items to contents and tools

Nested Navigation

Top navigation

Side navigation

Nested Navigation

Top navigation

_quarto.yml
website:
  navbar:
    left:
      - index.qmd
      - text: Work
        menu: 
          - talks.qmd
          - projects/index.qmd

Add a text item along with menu

Side navigation

_quarto.yml
website:
  sidebar:
    contents:
      - index.qmd
      - section: Work
        contents: 
          - talks.qmd
          - projects/index.qmd

Add a section with its own contents

Hybrid Navigation

Top navigation navigates between the different “sections” of the website.

Each “section” has its own side navigation.

Hybrid Navigation

_quarto.yml
website:
  navbar:
    left:
      - index.qmd
      - text: Work
        href: talks.qmd

  sidebar:
    - title: Work
      contents:
        - talks.qmd
        - projects/index.qmd
  1. Match navbar item text to a sidebar item title
  2. List navbar item href as first value in sidebar item contents

Automatic Sidebar

If your structure is good, an automatic sidebar can go a long way:

_quarto.yml
website:
  sidebar:
    contents: auto

Your Turn

Here’s three different navigation options for the same set of content:

Pick one, and discuss the pros and cons with your neighbor.

(Done? Expand your conversation to another option or another neighbor)

05:00

Pro and Cons

Pros Cons
Side nav
Top nav
Hybrid

Other navigation elements

For reference

Table of Contents

https://quarto.org/docs/output-formats/html-basics.html#table-of-contents

Controlled by format not website:

_quarto.yml
format:
  html: 
    toc: true

Wrapping Up

Wrapping Up

  • To add content:

    1. Add a page/pages in the structure of your site
    2. Add a link to the page in navigation
  • Listings (this afternoon) — Another navigation option

Your Turn

Work on your site: add pages, edit navigation, add/edit content.

We are here to help. Publish a new version before lunch.

10:00