-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: copy BlogTagsPostsPage from Docusaurus
* We want the ability to modify the default blog theme with a custom BlogTagsPostsPage * This copies the source into our repo and replaces the page in the build. * Update the title header to just be a capitalized tag
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from "react"; | ||
import clsx from "clsx"; | ||
import _ from "lodash"; | ||
import Translate from "@docusaurus/Translate"; | ||
import { | ||
PageMetadata, | ||
HtmlClassNameProvider, | ||
ThemeClassNames, | ||
} from "@docusaurus/theme-common"; | ||
import Link from "@docusaurus/Link"; | ||
import BlogLayout from "@theme/BlogLayout"; | ||
import BlogListPaginator from "@theme/BlogListPaginator"; | ||
import SearchMetadata from "@theme/SearchMetadata"; | ||
import type { Props } from "@theme/BlogTagsPostsPage"; | ||
import BlogPostItems from "@theme/BlogPostItems"; | ||
import Heading from "@theme/Heading"; | ||
|
||
function BlogTagsPostsPageMetadata({ tag }: Props): JSX.Element { | ||
const title = _.capitalize(tag.label); | ||
console.log(tag); | ||
return ( | ||
<> | ||
<PageMetadata title={title} description={tag.description} /> | ||
<SearchMetadata tag="blog_tags_posts" /> | ||
</> | ||
); | ||
} | ||
|
||
function BlogTagsPostsPageContent({ | ||
tag, | ||
items, | ||
sidebar, | ||
listMetadata, | ||
}: Props): JSX.Element { | ||
const title = _.capitalize(tag.label); | ||
return ( | ||
<BlogLayout sidebar={sidebar}> | ||
<header className="margin-bottom--xl"> | ||
<Heading as="h1">{title}</Heading> | ||
{tag.description && <p>{tag.description}</p>} | ||
<Link href={tag.allTagsPath}> | ||
<Translate | ||
id="theme.tags.tagsPageLink" | ||
description="The label of the link targeting the tag list page" | ||
> | ||
View All Tags | ||
</Translate> | ||
</Link> | ||
</header> | ||
<BlogPostItems items={items} /> | ||
<BlogListPaginator metadata={listMetadata} /> | ||
</BlogLayout> | ||
); | ||
} | ||
export default function BlogTagsPostsPage(props: Props): JSX.Element { | ||
return ( | ||
<HtmlClassNameProvider | ||
className={clsx( | ||
ThemeClassNames.wrapper.blogPages, | ||
ThemeClassNames.page.blogTagPostListPage, | ||
)} | ||
> | ||
<BlogTagsPostsPageMetadata {...props} /> | ||
<BlogTagsPostsPageContent {...props} /> | ||
</HtmlClassNameProvider> | ||
); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.