Skip to content

Commit 01caa83

Browse files
authored
fix: only return a single parent item for blog index parents/breadcrumbs (#262)
1 parent b70a321 commit 01caa83

File tree

1 file changed

+10
-2
lines changed
  • crates/rari-doc/src/pages/types

1 file changed

+10
-2
lines changed

crates/rari-doc/src/pages/types/spa.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::helpers::parents::parents;
2626
use crate::helpers::title::page_title;
2727
use crate::pages::json::{
2828
BlogIndex, BuiltPage, CommonJsonData, ItemContainer, JsonBlogPostDoc, JsonBlogPostPage,
29-
JsonHomePage, JsonHomePageSPAHyData, JsonSpaPage,
29+
JsonHomePage, JsonHomePageSPAHyData, JsonSpaPage, Parent,
3030
};
3131
use crate::pages::page::{Page, PageLike, PageReader};
3232
use crate::pages::templates::SpaBuildTemplate;
@@ -139,7 +139,15 @@ impl SPA {
139139
}),
140140
page_title: self.title().to_owned(),
141141
common: CommonJsonData {
142-
parents: parents(self),
142+
// Blog index is paginated, with the page as a path parameter, for example
143+
// `/en-US/blog/4`.
144+
// To avoid duplicate parent entries generated by traversing the URL,
145+
// just return the single base blog URL. The single Breadcrumb will always
146+
// link to the first blog index page.
147+
parents: vec![Parent {
148+
uri: "/en-US/blog/".to_string(),
149+
title: self.title().to_owned(),
150+
}],
143151
..Default::default()
144152
},
145153
image: None,

0 commit comments

Comments
 (0)