Skip to content

Commit

Permalink
update blog comment
Browse files Browse the repository at this point in the history
  • Loading branch information
wj-Mcat committed Aug 18, 2024
1 parent 6305cb0 commit 092919a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/00-agent-intro/00-what-is-agent.md
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
Expand Down
8 changes: 4 additions & 4 deletions src/components/GiscusComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ export default function GiscusComponent() {
<Giscus
repo="wj-Mcat/agent-handbook"
repoId="R_kgDOMKUZww"
category="Q&A"
categoryId="DIC_kwDOMKUZw84ChvU2" // E.g. id of "General"
mapping="url" // Important! To map comments to URL
category="General"
categoryId="DIC_kwDOMKUZw84ChvU1" // E.g. id of "General"
mapping="pathname" // Important! To map comments to URL
term="Welcome to @giscus/react component!"
strict="0"
reactionsEnabled="1"
emitMetadata="1"
inputPosition="top"
theme={colorMode}
lang="en"
lang="zh"
loading="lazy"
crossorigin="anonymous"
async
Expand Down
24 changes: 11 additions & 13 deletions src/theme/BlogPostItem/index.tsx
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 />}
</>
);
}

0 comments on commit 092919a

Please sign in to comment.