Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ const config: Config = {

// Giscus configuration
giscus: {
repo: 'YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME',
repoId: 'YOUR_REPOSITORY_ID',
category: 'Announcements',
categoryId: 'YOUR_CATEGORY_ID',
repo: process.env.GISCUS_REPO,
repoId: process.env.GISCUS_REPO_ID,
category: 'Pages',
categoryId: process.env.GISCUS_CATEGORY_ID,
},

// Comprehensive metadata for SEO
Expand Down
17 changes: 10 additions & 7 deletions src/components/GiscusComments/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import React from 'react';
import Giscus from '@giscus/react';
import { useColorMode } from '@docusaurus/theme-common';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';

interface GiscusConfig {
repo: string;
repoId: string;
category: string;
categoryId: string;
}

export default function GiscusComments() {
const { colorMode } = useColorMode();
const {
siteConfig: {
themeConfig: { giscus },
},
} = useDocusaurusContext();
const { siteConfig } = useDocusaurusContext();
const giscus = (siteConfig.themeConfig as any).giscus as GiscusConfig;

return (
<Giscus
id="comments"
repo={giscus.repo}
repo={giscus.repo as `${string}/${string}`}
repoId={giscus.repoId}
category={giscus.category}
categoryId={giscus.categoryId}
Expand Down
2 changes: 1 addition & 1 deletion src/theme/DocItem/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {useDoc} from '@docusaurus/plugin-content-docs/client';

type Props = WrapperProps<typeof FooterType>;

export default function FooterWrapper(props: Props): JSX.Element {
export default function FooterWrapper(props: Props) {
const {metadata} = useDoc();
const {frontMatter} = metadata;

Expand Down
4 changes: 4 additions & 0 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '@site/src/components/GiscusComments' {
const GiscusComments: React.FC;
export default GiscusComments;
}