Categories in a post's title block are not linked to the listing

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
57/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
frontend

调研方向

Start by tracing how q2 renders listing pages and the .quarto-category markup, then compare the behavior described in src/resources/formats/html/quarto.js and the listings plan at claude-notes/plans/2026-05-05-listings-epic.md. Check how q2 knows which listings contain a page and where category links can be emitted at render time. Done means title-block categories link to a containing listing with the category filter, including the described listing selection behavior.

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

描述

In Quarto 1, the categories shown in a post's title block link back to the listing that contains the post, filtered on that category (#category=R). quarto.js does it at load time: it fetches listings.json, keeps the listings whose items include the current page, picks one (the nearest parent listing, else the listing the reader came from, else the first one) and wraps each .quarto-category in a link.

q2 renders the same markup (<div class="quarto-category">R</div>) but emits neither listings.json nor the script, so the categories are plain text. The listing side already works: with categories: true, the category sidebar filters the items, and index.html#category=R filters on load.

The listings epic notes defer listings.json until search lands (claude-notes/plans/2026-05-05-listings-epic.md). This issue is about the user-visible part: linking title-block categories to their listing.

Reproduction:

# _quarto.yml
project:
  type: website
# index.qmd
---
title: Blog
listing:
  contents: posts
  categories: true
---
# posts/a/index.qmd
---
title: A post
categories: [R]
---

q2 render, open _site/posts/a/index.html: the "R" category is not a link. In Quarto 1 it links to the root listing (/index.html#category=R).

We could write the links at render time instead, since q2 knows which listings include a page: no listings.json, no fetch. The nearest parent listing, then the first one, can be chosen the same way as Quarto 1. Only the referrer case needs the browser.

Workaround used on cderv.dev: a small include-after-body script in the theme extension that links each category to the root index.html (cderv/quarto-ghostwriter#7).

主要语言
Rust
星标
316
派生
23
平均合并
11 小时 49 分钟
30 天内合并 PR
245

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

quarto-dev/q2 的其他 Issue

查看 quarto-dev/q2 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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