quarto-dev / quarto-cli

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

max-items in listings will make pagination and categories fail #9234

Open produnis opened 3 months ago

produnis commented 3 months ago

Bug description

In my blog, I have about 370 posts. If I set max-items parameter in listing like this

listing:
  - id: blog
    contents: posts
    sort: "date desc"
    type: default #grid # default # table
    sort-ui: false
    filter-ui: false
    max-items: 15 # 25

pagination and categories will fail: there is no pagination at the bottom of the listing. Categories are shown in the sidebar, but if you click on a category, nothing will happen. Each "#category=FOOBAR" will show the main listing.

If I remove max-items, then everything works again as expected.

Steps to reproduce

create a listing that has many entries. Set max-items Paramenter to e.g. 5.

Expected behavior

Listings shows the max-items ammount of entries (e.g. 5 entries), pagination is at the bottom of the listing, category-links will show a list of category items only

Actual behavior

There won't be any paginations, and all links of categories will just show the main listing.

Remove the max-items parameter, and pagiantions will reappear und category-links will work

Your environment

Archlinux

Quarto check output

Quarto 1.5.27
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.27
      Path: /opt/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /sbin
      Version: undefined

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.8
      Path: /sbin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.3
      Path: /usr/lib64/R
      LibPaths:
        - /home/produnis/R/x86_64-pc-linux-gnu-library/4.3
        - /usr/lib/R/library
      knitr: 1.45
      rmarkdown: 2.25

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

...but it also happens with the current 1.4 release....

mcanouil commented 3 months ago

Thanks for the report.

Here is a reproducible example for this case: https://github.com/mcanouil/quarto-issues-experiments/tree/main/quarto-cli-9234

PS: Could you in the future provide a reproducible example. It would be appreciated.

mcanouil commented 3 months ago

Categories were working in 1.3, but pagination seemed to already been broken when setting the maximum number of items to be included (regardless of the number of items per page).

Edit: the issue on pagination was there since 1.0.38 (at least).

mcanouil commented 3 months ago

@produnis max-items is not the same as page-size by the way in case you did not notice the difference, i.e., setting max-items: 25 means only 25 of your 370 posts will be accessible via the listing (I am not sure you want to hide posts).