Skip to content

Commit ee975fb

Browse files
authored
docs: remove giscus component (#2133)
<!-- CURSOR_SUMMARY --> > [!NOTE] > Removes Giscus comments from doc pages and drops related config, styles, and dependency. > > - **Theme (doc item layout)**: > - Remove `Giscus` component, wrapper, and display logic from `src/theme/DocItem/Layout/index.js`. > - Simplify imports accordingly. > - **Config**: > - Delete `customFields.forbiddenGiscusDocRegExpStrings` from `docusaurus.config.js`. > - **Styles**: > - Remove `.giscus` CSS from `src/theme/DocItem/Layout/styles.module.css`. > - **Dependencies**: > - Remove `@giscus/react` from `package.json` and related entries from `package-lock.json`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f209f80. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 336d051 commit ee975fb

File tree

5 files changed

+4
-115
lines changed

5 files changed

+4
-115
lines changed

docusaurus.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,6 @@ module.exports = {
533533
},
534534
staticDirectories: ['apify-docs-theme/static', 'static'],
535535
customFields: {
536-
forbiddenGiscusDocRegExpStrings: [
537-
'^/legal',
538-
'^/legal/*',
539-
],
540536
...config.customFields ?? [],
541537
},
542538
clientModules: ['./clientModule.js'],

package-lock.json

Lines changed: 2 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"@docusaurus/preset-classic": "^3.8.1",
7171
"@docusaurus/theme-common": "^3.8.1",
7272
"@docusaurus/theme-mermaid": "^3.8.1",
73-
"@giscus/react": "^3.0.0",
7473
"@redocly/cli": "^2.0.0",
7574
"@signalwire/docusaurus-plugin-llms-txt": "^1.2.1",
7675
"clsx": "^2.0.0",

src/theme/DocItem/Layout/index.js

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { useDoc } from '@docusaurus/plugin-content-docs/client';
2-
import { useLocation } from '@docusaurus/router';
3-
import { useColorMode, useWindowSize } from '@docusaurus/theme-common';
4-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
5-
import Giscus from '@giscus/react';
2+
import { useWindowSize } from '@docusaurus/theme-common';
63
import ContentVisibility from '@theme/ContentVisibility';
74
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
85
import DocItemFooter from '@theme/DocItem/Footer';
@@ -13,7 +10,7 @@ import DocItemContent from '@theme/DocItemContent';
1310
import DocVersionBadge from '@theme/DocVersionBadge';
1411
import DocVersionBanner from '@theme/DocVersionBanner';
1512
import clsx from 'clsx';
16-
import React, { useCallback } from 'react';
13+
import React from 'react';
1714

1815
import styles from './styles.module.css';
1916

@@ -36,45 +33,9 @@ function useDocTOC() {
3633
};
3734
}
3835

39-
function GiscusWrapper({ colorMode }) {
40-
return (
41-
<React.Fragment>
42-
<div className={styles.giscus}>
43-
<Giscus
44-
id="giscus-comments"
45-
repo="apify/apify-docs"
46-
repoId="MDEwOlJlcG9zaXRvcnkxOTk0Njc5ODk="
47-
category="Comments"
48-
categoryId="DIC_kwDOC-Oj1c4CT-aW"
49-
mapping="pathname"
50-
reactionsEnabled="1"
51-
emitMetadata="0"
52-
inputPosition="top"
53-
theme={colorMode}
54-
lang="en"
55-
strict="1"
56-
/>
57-
</div>
58-
</React.Fragment>
59-
);
60-
}
61-
6236
export default function DocItemLayout({ children }) {
6337
const docTOC = useDocTOC();
6438
const { metadata } = useDoc();
65-
const { colorMode } = useColorMode();
66-
const location = useLocation();
67-
const { siteConfig } = useDocusaurusContext();
68-
69-
const { forbiddenGiscusDocRegExpStrings } = siteConfig.customFields;
70-
71-
const shouldShowGiscus = useCallback((rxStrings) => {
72-
return rxStrings.some((rxs) => {
73-
const pathRegExp = new RegExp(rxs);
74-
const isForbidden = pathRegExp.test(location.pathname);
75-
return !isForbidden;
76-
});
77-
}, [location.pathname]);
7839

7940
return (
8041
<div className="row">
@@ -90,7 +51,6 @@ export default function DocItemLayout({ children }) {
9051
<DocItemFooter />
9152
</article>
9253
<DocItemPaginator />
93-
{shouldShowGiscus(forbiddenGiscusDocRegExpStrings) && <GiscusWrapper colorMode={colorMode} />}
9454
</div>
9555
</div>
9656
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}

src/theme/DocItem/Layout/styles.module.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
margin-right: 16px;
88
}
99

10-
.giscus {
11-
display: block;
12-
margin-top: 50px;
13-
}
14-
1510
.docItemContainer header + *,
1611
.docItemContainer article > *:first-child {
1712
margin-top: 0;

0 commit comments

Comments
 (0)