Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor auto-nav to use {{< insert >}} #16

Open
andrewpbray opened this issue Mar 28, 2024 · 0 comments
Open

refactor auto-nav to use {{< insert >}} #16

andrewpbray opened this issue Mar 28, 2024 · 0 comments

Comments

@andrewpbray
Copy link
Contributor

andrewpbray commented Mar 28, 2024

Instead of having users specify where they want auto-navigation via the auto-nav key, allow the use of a shortcode like {{< insert Notes >}} anywhere within the existing description of the website nav in _quarto.yml.

Simplified example

If the aim is for the project scripts to produce an adaptive sidebar nav that pulls from all items where type: Notes in course-website: schedule to produce, say:

website:
  sidebar:
    logo: assets/stat_bear.png
    contents:
      - href: index.qmd
        text: Home
      - href: syllabus.qmd
        text: Syllabus
      - section: Notes
        contents:
          - notes1.qmd
          - notes2.qmd

Here are two ways that the user could specify this.

Existing version

website:
  sidebar:
    logo: assets/stat_bear.png
    contents:
      - href: index.qmd
        text: Home
      - href: syllabus.qmd
        text: Syllabus

course-website:
  auto-nav:
    sidebar:
      - type: Notes

Proposed version

website:
  sidebar:
    logo: assets/stat_bear.png
    contents:
      - href: index.qmd
        text: Home
      - href: syllabus.qmd
        text: Syllabus
      - section: Notes
        contents:
          - "{{< insert Notes >}}"

Rationale for the change

  1. More flexibility in the structure of navigation. The user hard-codes the structure that they want into website: sidebar and just uses the shortcode as a variable where the adaptive content will be inserted. In the existing version, we assume a simple nav structure when we write the contents yaml.
  2. No need to match structure/syntax. In the current setup, the user has to learn how to use the options under auto-nav to be sure they match where they want the contents yaml to show up in the nav. This eliminates the need for auto-nav entirely; they can just read the quarto docs for understanding website nav.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant