quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.95k stars 326 forks source link

Website Sidebar Links Not Working for some pages #10102

Closed s2t2 closed 4 months ago

s2t2 commented 4 months ago

Bug description

Unable to click links in sidebar.

Next page navigation will get to the page though. And direct navigation via URL bar will get to the page. But the sidebar text is not a hyperlink as it should be.

Steps to reproduce

Contents of "_quarto.yml":

project:
  type: website # book
  output-dir: _build
  preview:
    port: 3456 # use the same port instead of a new one each time
    browser: true

jupyter: python3
execute:
  cache: true # re-render only when source changes

# https://quarto.org/docs/reference/projects/websites.html#section
website:
  title: "Python for Finance"
  site-url: https://prof-rossetti.github.io/python-for-finance/
  repo-url: https://github.com/prof-rossetti/python-for-finance
  repo-branch: main
  repo-actions: [edit, issue, source]
  search: true
  reader-mode: false
  page-navigation: true
  back-to-top-navigation: false
  bread-crumbs: true

  # https://quarto.org/docs/reference/projects/websites.html#navbar
  navbar:
    right:
      - about-author.qmd

  # https://quarto.org/docs/reference/projects/websites.html#sidebar
  sidebar:
    contents:
      - index.qmd
      - why-python.qmd

      #- "---------"
      - section: notes/dev-tools/index.qmd
        contents:
          - section: notes/dev-tools/google-colab/overview.qmd
            contents:
              - section: notes/dev-tools/google-colab/form-inputs.qmd
              - section: notes/dev-tools/google-colab/notebook-secrets.qmd
              - section: notes/dev-tools/google-colab/integrations.qmd
                text: "Advanced Integrations"
          - section: notes/dev-tools/pip.qmd

      - "---------"
      - section: courses/fin-apps.qmd
        text: "I. Financial Applications" # "I. Intro to Financial Applications"
        contents:
          - section: notes/python-lang.qmd

          - section: notes/basic-datatypes/index.qmd
            contents:
              - notes/basic-datatypes/numbers.qmd
              - notes/basic-datatypes/strings.qmd
              - notes/basic-datatypes/booleans.qmd

          - section: notes/python-operators.qmd

          - section: notes/control-flow/index.qmd
            contents:
              - notes/control-flow/conditional-logic.qmd
              - section: notes//control-flow/custom-functions.qmd
                contents:
                - notes/control-flow/function-docs.qmd
                - notes/control-flow/unit-testing.qmd

          - section: notes/container-datatypes/index.qmd
            contents:
              - notes/container-datatypes/lists.qmd
              - notes/container-datatypes/dictionaries.qmd

          - section: notes/python-modules/index.qmd
            contents:
              - notes/python-modules/datetime.qmd
              - notes/python-modules/random.qmd
              - notes/python-modules/statistics.qmd

      - "---------"
      - about-author.qmd

format:
  # https://quarto.org/docs/reference/formats/html.html#table-of-contents
  html:
    theme: cosmo
    code-copy: true
    code-fold: show
    toc: true

Buggy Sidebar nav, only pages with dropdowns are clickable:

Screenshot 2024-06-22 at 6 23 30 PM Screenshot 2024-06-22 at 6 23 42 PM

Expected behavior

See page name in left side bar. Click it and visit the page.

Actual behavior

See page name in left sidebar. But there is no link and it is not possible to click.

Your environment

No response

Quarto check output

(quarto-env)  --->> quarto check
Quarto 1.4.554
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.554
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/local/bin
      Version: undefined

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.9 (Conda)
      Path: /opt/anaconda3/envs/quarto-env/bin/python
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.3.1
      Path: /usr/local/Cellar/r/4.3.1/lib/R
      LibPaths:
        - /usr/local/lib/R/4.3/site-library
        - /usr/local/Cellar/r/4.3.1/lib/R/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")
s2t2 commented 4 months ago

It seems like if I add an "id" attribute, the page will start being clickable?

         - section:
            id: pip
            href: notes/dev-tools/pip.qmd

I guess this is a hacky workaround?

s2t2 commented 4 months ago

I guess text will make the entry work as well:

         - section:
            text: "Package Installation with Pip"
            href: notes/dev-tools/pip.qmd
s2t2 commented 4 months ago

This will NOT work though?

     - section: index.qmd
        text: "Preface"
s2t2 commented 4 months ago

So it needs an href?

This works:

         - section:
            href: notes/dev-tools/pip.qmd
mcanouil commented 4 months ago

You stated "Website Sidebar Links Not Working for some pages" but you did not provide a reproducible example. sections are supposed to delimit contents, not be contents on their own.

So from your snippet, I believe all sections without contents don't have links.

InputOutput
```sh quarto create project website issue-10102 Issue-10102 ``` With `_quarto.yml`: ````qmd project: type: website website: title: "Issue -10102" navbar: left: - href: index.qmd text: Home - about.qmd sidebar: contents: - section: Redirection to about.qmd # working fine href: about.qmd contents: - index.qmd - section: about.qmd # Working fine contents: - index.qmd - section: about.qmd # This is the section that is not working - about.qmd # Working fine - text: Redirection to about.qmd # Working fine href: about.qmd format: html: theme: cosmo css: styles.css toc: true ```` https://github.com/quarto-dev/quarto-cli/assets/8896044/c80e2286-e918-4bdb-8294-34a10e45c417

I suggest you replace - section: about.qmd # This is the section that is not working with - about.qmd which is the correct syntax.