-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
16 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
comments: true | ||
sidebar_position: 1 | ||
slug: what-is-agent | ||
enableComments: true | ||
--- | ||
|
||
# 什么是Agent | ||
|
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 |
---|---|---|
@@ -1,22 +1,20 @@ | ||
import React from 'react'; | ||
import { useBlogPost } from '@docusaurus/theme-common/internal' | ||
import BlogPostItem from '@theme-original/BlogPostItem'; | ||
import GiscusComponent from '@site/src/components/GiscusComponent'; | ||
import useIsBrowser from '@docusaurus/useIsBrowser'; | ||
import React from "react"; | ||
import BlogPostItem from "@theme-original/BlogPostItem"; | ||
import type BlogPostItemType from "@theme/BlogPostItem"; | ||
import type { WrapperProps } from "@docusaurus/types"; | ||
import { useBlogPost } from "@docusaurus/theme-common/internal"; | ||
import GiscusComponent from "@site/src/components/GiscusComponent"; | ||
|
||
export default function BlogPostItemWrapper(props) { | ||
const { metadata, isBlogPostPage } = useBlogPost() | ||
const isBrowser = useIsBrowser(); | ||
type Props = WrapperProps<typeof BlogPostItemType>; | ||
|
||
const { frontMatter, slug, title } = metadata | ||
const { enableComments } = frontMatter | ||
export default function BlogPostItemWrapper(props: Props): JSX.Element { | ||
const { metadata, isBlogPostPage } = useBlogPost(); | ||
const { comments = true } = metadata.frontMatter; | ||
|
||
return ( | ||
<> | ||
<BlogPostItem {...props} /> | ||
{(enableComments && isBlogPostPage) && ( | ||
<GiscusComponent /> | ||
)} | ||
{comments && isBlogPostPage && <GiscusComponent />} | ||
</> | ||
); | ||
} |