Skip to content

Commit 9712ead

Browse files
stats: index page is no longer displayed as orphan page (#1447)
1 parent be4c1ca commit 9712ead

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Fix: `/_stats` displays index page stats instead of treating it as orphan page

znai-reactjs/src/screens/doc-stats/DocStatsView.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import React, { useEffect, useRef } from "react";
1818
import { TocItem } from "../../structure/TocItem";
1919
import { documentationNavigation } from "../../structure/DocumentationNavigation";
20-
import { isTocItemIndex } from "../../structure/toc/TableOfContents";
2120

2221
import "./DocStatsView.css";
2322

@@ -59,9 +58,7 @@ function collectTocPageIds(toc: TocItem[]): Set<string> {
5958
const pageIds = new Set<string>();
6059
for (const chapter of toc) {
6160
for (const item of chapter.items || []) {
62-
if (!isTocItemIndex(item)) {
63-
pageIds.add(buildPageId(item.dirName, item.fileName));
64-
}
61+
pageIds.add(buildPageId(item.dirName, item.fileName));
6562
}
6663
}
6764
return pageIds;
@@ -119,7 +116,7 @@ function PageItem({ item, stats }: PageItemProps) {
119116
return (
120117
<div className="znai-doc-stats-page-item">
121118
<a href={href} className="znai-doc-stats-page-link">
122-
{item.pageTitle}
119+
{item.pageTitle || item.fileName}
123120
</a>
124121
<StatsCounters stats={stats ?? ZERO_STATS} />
125122
</div>
@@ -133,7 +130,7 @@ interface ChapterSectionProps {
133130
}
134131

135132
function ChapterSection({ chapter, chapterStats, pageStats }: ChapterSectionProps) {
136-
const items = (chapter.items || []).filter((item) => !isTocItemIndex(item));
133+
const items = chapter.items || [];
137134

138135
if (items.length === 0) {
139136
return null;

0 commit comments

Comments
 (0)