Skip to content

fix: show contributor count on contributors page - #43

Merged
LeoninCS merged 1 commit into
LeoninCS:mainfrom
4evour:agent/remove-contributors-count
Aug 3, 2026
Merged

fix: show contributor count on contributors page#43
LeoninCS merged 1 commit into
LeoninCS:mainfrom
4evour:agent/remove-contributors-count

Conversation

@4evour

@4evour 4evour commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Show 共 N 位贡献者 on the contributors page, using the same contributor data array that renders the cards.
  • Normalize the content path before identifying the contributors page so local Windows previews match Linux builds.
  • Keep article counts unchanged on all other section pages.

Why

The shared section template counted child pages, but the contributors page is data-driven. That produced the misleading 共 0 篇 label even though contributor cards were present. The deployment workflow regenerates the contributor data from merged pull requests, so the displayed count now updates with that data instead of being hard-coded.

Impact

Only the contributors page header changes. Contributor cards and article counts on other section pages remain unchanged.

Validation

  • hugo --minify with Hugo Extended 0.159.0
  • Ran the repository contributor generator against LeoninCS/GoClub: 25 contributors generated
  • Rendered check: 共 25 位贡献者, 25 contributor cards, and no 共 0 篇
  • Desktop and mobile local-browser checks with no console warnings or errors
  • Verified the technical blog section still renders its article count

@4evour
4evour force-pushed the agent/remove-contributors-count branch from 4f5bd9b to fd3a76b Compare August 3, 2026 10:35
@4evour 4evour changed the title fix: hide empty contributor count fix: show contributor count on contributors page Aug 3, 2026
@LeoninCS
LeoninCS marked this pull request as ready for review August 3, 2026 12:05
Copilot AI review requested due to automatic review settings August 3, 2026 12:05
@LeoninCS
LeoninCS merged commit e6a03d8 into LeoninCS:main Aug 3, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 修复了 contributors(贡献者)分区页的头部统计口径:该页面是数据驱动渲染贡献者卡片的,不应再沿用通用分区模板的“子页面篇数”统计,从而避免出现“共 0 篇”的误导信息,并兼容 Windows 本地预览与 Linux 构建的路径差异。

Changes:

  • 在 contributors 页头部显示 共 N 位贡献者,计数来源与贡献者卡片使用同一份 hugo.Data.contributors 数据。
  • .File.Path 做分隔符归一化(\ -> /),保证 Windows 预览与 Linux 构建一致识别 contributors 页。
  • 其他 docs 分区页继续显示“共 N 篇”文章数统计,不改变既有行为。

Comment thread layouts/docs/list.html
{{ $content := partial "goclub/stripped-content.html" . }}
{{ $filePath := replace .File.Path "\\" "/" }}
{{ $isContributors := eq $filePath "docs/contributors/_index.md" }}
{{ $contributors := hugo.Data.contributors }}
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

Successfully merging this pull request may close these issues.

3 participants