Skip to content

Commit f85e0d1

Browse files
authored
[Docs Site] Add learning path name into sidebar title (#16185)
1 parent 9049bf9 commit f85e0d1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/components/overrides/Sidebar.astro

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,18 @@ filtered.entries = filtered.entries.sort(sortGroup);
152152
153153
filtered.entries[0].label = "Overview";
154154
155-
const lookupProductTitle = async (product: string) => {
155+
const lookupProductTitle = async (slug: string) => {
156+
const segments = slug.split("/");
157+
const product = segments[0];
158+
159+
if (product === "learning-paths") {
160+
const path = segments[1];
161+
162+
const { data } = await getEntry("learning-paths", path);
163+
164+
return `${data.title} (Learning Paths)`;
165+
}
166+
156167
const { data } = await getEntry("products", product);
157168
158169
return data.product.title;
@@ -164,8 +175,10 @@ const lookupProductTitle = async (product: string) => {
164175
class="items-center flex hover:opacity-80 decoration-accent-200"
165176
>
166177
<AstroIcon name={currentSection} class="text-accent-200 text-4xl mr-2" />
167-
<h3 class="text-black dark:text-white">
168-
{lookupProductTitle(currentSection)}
169-
</h3>
178+
<span class="text-black dark:text-white">
179+
<strong>
180+
{lookupProductTitle(slug)}
181+
</strong>
182+
</span>
170183
</a>
171184
<Default {...Astro.props} sidebar={filtered.entries}><slot /></Default>

0 commit comments

Comments
 (0)