Skip to content

Commit

Permalink
Fix/breadcrumbs (#138)
Browse files Browse the repository at this point in the history
* fix(breadcrumbs): fix the home page breadcrumb issue

* chore(pr_template): move pr template from github workflows

---------

Co-authored-by: “Sahitya <“[email protected]”>
  • Loading branch information
bsahitya and “Sahitya authored Sep 24, 2024
1 parent 8aaac3e commit ea87686
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
File renamed without changes.
4 changes: 1 addition & 3 deletions src/config/header.navitems.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ export default function headerItems(baseUrl = '/', currentLocale = 'en') {
title: 'header.title',
navItems: [
{
href: `/quickstarts/${
['es', 'ja', 'en'].includes(currentLocale) ? locale : ''
}`,
href: `${baseUrl ?? ''}${locale ?? ''}/quickstarts`,
label: 'header.getting_started',
},
{
Expand Down
20 changes: 17 additions & 3 deletions src/theme/DocBreadcrumbs/Items/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,39 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
import { translate } from '@docusaurus/Translate';
import { useActivePlugin } from '@docusaurus/plugin-content-docs/client';

const getBreadcrumbTranslationId = (activePluginId = ''): string => {
switch (activePluginId) {
case 'quickstarts':
return 'header.getting_started';
case 'default':
default:
return 'header.docs.ai_unlimited';
}
};

export default function HomeBreadcrumbItem() {
const homeHref = useBaseUrl('/');
const activePlugin = useActivePlugin(undefined);
const homeLabel = translate({
id: 'theme.docs.breadcrumbs.home',
message: 'Home',
});

const docsLabel = translate({
id: `theme.docs.breadcrumbs.${activePlugin?.pluginId}`,
id: getBreadcrumbTranslationId(activePlugin?.pluginId),
message: 'AI Unlimited',
});
});

return (
<>
<li className="breadcrumbs__item">
<Link
aria-label={homeLabel}
className="breadcrumbs__link"
href={homeHref}
>{homeLabel}</Link>
>
{homeLabel}
</Link>
</li>
<li className="breadcrumbs__item">
<Link
Expand Down

0 comments on commit ea87686

Please sign in to comment.