Skip to content

Commit

Permalink
correct slugs and descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
e-im committed Apr 8, 2022
1 parent 72ac1bc commit d78e66a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 55 deletions.
6 changes: 3 additions & 3 deletions config/navbar.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Navbar} from "@docusaurus/theme-common";
import { Navbar } from "@docusaurus/theme-common";

const navbar: Omit<Navbar, "style"> = { // don't specify style here, we want it to be dynamic
// don't specify style or hideOnScroll here, we want it to be dynamic
const navbar: Omit<Navbar, "style" | "hideOnScroll"> = {
title: "PaperMC Docs",
hideOnScroll: true,
logo: {
src: "img/logo.svg",
alt: "PaperMC Logo",
Expand Down
42 changes: 32 additions & 10 deletions config/sidebars.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";
const sidebars: SidebarsConfig = {
docs: [
{
type: "link",
label: "Support Discord",
href: "https://discord.gg/papermc",
type: "category",
label: "Getting Help",
items: [
{
type: "link",
label: "Discord",
href: "https://discord.gg/papermc",
},
{
type: "link",
label: "Forums",
href: "https://forums.papermc.io",
},
],
},
"README",
{
Expand Down Expand Up @@ -33,7 +44,8 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "How-to Guides",
link: {
type: "generated-index"
type: "generated-index",
slug: "/category/paper/how-to-guides",
},
items: [
"paper/how-to/per-world-configuration",
Expand All @@ -47,6 +59,7 @@ const sidebars: SidebarsConfig = {
label: "Reference",
link: {
type: "generated-index",
slug: "/category/paper/reference",
},
items: [
"paper/reference/paper-global-configuration",
Expand Down Expand Up @@ -81,7 +94,8 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "How-to Guides",
link: {
type: "generated-index"
type: "generated-index",
slug: "/category/velocity/how-to-guides",
},
items: [
"velocity/how-to/security",
Expand All @@ -94,6 +108,7 @@ const sidebars: SidebarsConfig = {
label: "Reference",
link: {
type: "generated-index",
slug: "/category/velocity/reference",
},
items: [
"velocity/reference/configuration",
Expand All @@ -116,7 +131,8 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "Getting Started",
link: {
type: "generated-index"
type: "generated-index",
slug: "/category/velocity/developers/getting-started",
},
items: [
"velocity/developers/getting-started/creating-your-first-plugin",
Expand All @@ -128,7 +144,8 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "How-to Guides",
link: {
type: "generated-index"
type: "generated-index",
slug: "/category/velocity/developers/how-to-guides",
},
items: [
"velocity/developers/how-to/dependencies",
Expand All @@ -139,7 +156,8 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "API",
link: {
type: "generated-index"
type: "generated-index",
slug: "/category/velocity/developers/api",
},
items: [
"velocity/developers/api/event",
Expand All @@ -164,15 +182,19 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "Common",
link: {
type: "generated-index"
type: "generated-index",
slug: "/category/common",
description: "Documentation relevant to all PaperMC projects.",
},
items: ["common/java-install"],
},
{
type: "category",
label: "PaperMC",
link: {
type: "generated-index"
type: "generated-index",
slug: "/category/papermc",
description: "Information about the PaperMC Organization.",
},
items: ["papermc/downloads-api", "papermc/assets", "papermc/contact"],
},
Expand Down
54 changes: 19 additions & 35 deletions src/theme/DocBreadcrumbs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import React, {type ReactNode} from 'react';
import {
ThemeClassNames,
useSidebarBreadcrumbs,
useHomePageRoute,
} from '@docusaurus/theme-common';
import styles from './styles.module.css';
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useBaseUrl from '@docusaurus/useBaseUrl';
import React, { type ReactNode } from "react";
import { ThemeClassNames, useSidebarBreadcrumbs, useHomePageRoute } from "@docusaurus/theme-common";
import styles from "./styles.module.css";
import clsx from "clsx";
import Link from "@docusaurus/Link";
import useBaseUrl from "@docusaurus/useBaseUrl";

// TODO move to design system folder
function BreadcrumbsItemLink({
Expand All @@ -17,7 +13,7 @@ function BreadcrumbsItemLink({
children: ReactNode;
href?: string;
}): JSX.Element {
const className = 'breadcrumbs__link';
const className = "breadcrumbs__link";
return href ? (
<Link className={className} href={href} itemProp="item">
<span itemProp="name">{children}</span>
Expand All @@ -44,22 +40,21 @@ function BreadcrumbsItem({
itemScope
itemProp="itemListElement"
itemType="https://schema.org/ListItem"
className={clsx('breadcrumbs__item', {
'breadcrumbs__item--active': active,
})}>
className={clsx("breadcrumbs__item", {
"breadcrumbs__item--active": active,
})}
>
{children}
<meta itemProp="position" content={String(index + 1)} />
</li>
);
}

function HomeBreadcrumbItem() {
const homeHref = useBaseUrl('/');
const homeHref = useBaseUrl("/");
return (
<li className="breadcrumbs__item">
<Link
className={clsx('breadcrumbs__link', styles.breadcrumbsItemLink)}
href={homeHref}>
<Link className={clsx("breadcrumbs__link", styles.breadcrumbsItemLink)} href={homeHref}>
🏠
</Link>
</li>
Expand All @@ -76,25 +71,14 @@ export default function DocBreadcrumbs(): JSX.Element | null {

return (
<nav
className={clsx(
ThemeClassNames.docs.docBreadcrumbs,
styles.breadcrumbsContainer,
)}
aria-label="breadcrumbs">
<ul
className="breadcrumbs"
itemScope
itemType="https://schema.org/BreadcrumbList">
className={clsx(ThemeClassNames.docs.docBreadcrumbs, styles.breadcrumbsContainer)}
aria-label="breadcrumbs"
>
<ul className="breadcrumbs" itemScope itemType="https://schema.org/BreadcrumbList">
{homePageRoute && <HomeBreadcrumbItem />}
{breadcrumbs.map((item, idx) => (
<BreadcrumbsItem
key={idx}
active={idx === breadcrumbs.length - 1}
index={idx}>
<BreadcrumbsItemLink
href={item.href}> {/* papermc - breadcrumb links on all pages, even current */}
{item.label}
</BreadcrumbsItemLink>
<BreadcrumbsItem key={idx} active={idx === breadcrumbs.length - 1} index={idx}>
<BreadcrumbsItemLink href={item.href}> {item.label}</BreadcrumbsItemLink>
</BreadcrumbsItem>
))}
</ul>
Expand Down
7 changes: 0 additions & 7 deletions src/theme/DocBreadcrumbs/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

.breadcrumbsContainer {
--ifm-breadcrumb-size-multiplier: 0.8;
margin-bottom: 0.8rem;
Expand Down

0 comments on commit d78e66a

Please sign in to comment.