Pages with categories request listings.json, which 404s when the site has no listing

未关闭
#15,228 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
frontend, web-dev

调研方向

Start with findAndActivateCategories() in quarto.js and updateGlobalListingIndex() in src/project/types/website/listing/website-listing-index.ts; compare the website and standalone rendering paths described in the issue. Check how the script determines whether listings are available and how the index is written. Done means pages with categories and no listings make no failing listings.json request in either case.

由索引模型根据 Issue 内容生成。

描述

enhancement listings
I have:
  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide
Bug description

When a page has categories in its title block, quarto.js fetches listings.json to turn the categories into links to a listing (findAndActivateCategories()).
If no listing exists, that file is not there, so every such page makes a request that returns 404 and logs an error in the browser console.
Rendering is not affected, because the script only reads the response when the status is 200.

This happens in two places:

  • A website with no listing page. updateGlobalListingIndex() in src/project/types/website/listing/website-listing-index.ts only writes listings.json when listingPaths.length > 0.
  • A standalone HTML document with categories. The fetch runs here as well, against listings.json next to the document.

For websites, writing listings.json every time (as [] when there are no listings) would remove the 404.
The standalone case would need the script to know whether listings exist before it fetches.

This is mostly cosmetic.

Steps to reproduce

A website with no listing:

# _quarto.yml
project:
  type: website

website:
  title: "Repro"
---
title: "Home"
categories: [one, two]
---

A page with categories, in a website with no listing.

A standalone document:

---
title: "Standalone"
categories: [one, two]
format: html
---

A standalone document with categories.

Render each one, serve the output over HTTP, open the page and look at the network panel and the console.

Actual behavior

Both pages request listings.json, get a 404, and log Failed to load resource: the server responded with a status of 404 (Not Found) in the console.

Expected behavior

No request for listings.json when there is no listing to link to, and no console error.

Your environment
  • OS: macOS 27.0.1.
  • Browser: Chromium (Brave), headless.
Quarto check output
Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.10.0: OK
      Dart Sass version 1.101.0: OK
      Deno version 2.9.8: OK
      Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: 6f81421488bde28d87cee51c9988e666bc09f7be
主要语言
JavaScript
星标
6.1k
派生
478
平均合并
17 小时 7 分钟
30 天内合并 PR
112

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/quarto-cli 的其他 Issue

查看 quarto-dev/quarto-cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。