Skip to content

Commit f011e29

Browse files
committed
feat: add AI actions dropdown with ChatGPT integration
- Add AI dropdown button in breadcrumbs (WordLift blue with white text) - Integrate ChatGPT with dynamic page context (title + URL) - Add copy page link and view raw markdown actions - Remove old AI chat buttons plugin (bottom-right corner) - Add ChatGPT logo SVG - Improve markdown path detection for better GitHub links
1 parent ee758dc commit f011e29

File tree

8 files changed

+331
-153
lines changed

8 files changed

+331
-153
lines changed

docusaurus.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ const config = {
1313
url: "https://docs.wordlift.io",
1414
baseUrl: "/",
1515
onBrokenLinks: "warn",
16-
onBrokenMarkdownLinks: "warn",
1716
favicon: "img/logo-tile.svg",
1817
trailingSlash: true,
1918

19+
// Markdown configuration
20+
markdown: {
21+
hooks: {
22+
onBrokenMarkdownLinks: "warn",
23+
},
24+
},
25+
2026
// GitHub pages deployment config.
2127
// If you aren't using GitHub pages, you don't need these.
2228
organizationName: "wordlift", // Usually your GitHub org/user name.
@@ -528,7 +534,6 @@ const config = {
528534
],
529535
},
530536
],
531-
"./src/plugins/ai-chat-buttons",
532537
function chatWidgetPlugin() {
533538
return {
534539
name: "chat-widget-plugin",

src/plugins/ai-chat-buttons/index.js

Lines changed: 0 additions & 151 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React, {type ReactNode} from 'react';
2+
import Link from '@docusaurus/Link';
3+
import useBaseUrl from '@docusaurus/useBaseUrl';
4+
import {translate} from '@docusaurus/Translate';
5+
import IconHome from '@theme/Icon/Home';
6+
7+
import styles from './styles.module.css';
8+
9+
export default function HomeBreadcrumbItem(): ReactNode {
10+
const homeHref = useBaseUrl('/');
11+
12+
return (
13+
<li className="breadcrumbs__item">
14+
<Link
15+
aria-label={translate({
16+
id: 'theme.docs.breadcrumbs.home',
17+
message: 'Home page',
18+
description: 'The ARIA label for the home page in the breadcrumbs',
19+
})}
20+
className="breadcrumbs__link"
21+
href={homeHref}>
22+
<IconHome className={styles.breadcrumbHomeIcon} />
23+
</Link>
24+
</li>
25+
);
26+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.breadcrumbHomeIcon {
2+
position: relative;
3+
top: 1px;
4+
vertical-align: top;
5+
height: 1.1rem;
6+
width: 1.1rem;
7+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, {type ReactNode} from 'react';
2+
import Head from '@docusaurus/Head';
3+
import {useBreadcrumbsStructuredData} from '@docusaurus/plugin-content-docs/client';
4+
import type {Props} from '@theme/DocBreadcrumbs/StructuredData';
5+
6+
export default function DocBreadcrumbsStructuredData(props: Props): ReactNode {
7+
const structuredData = useBreadcrumbsStructuredData({
8+
breadcrumbs: props.breadcrumbs,
9+
});
10+
return (
11+
<Head>
12+
<script type="application/ld+json">
13+
{JSON.stringify(structuredData)}
14+
</script>
15+
</Head>
16+
);
17+
}

0 commit comments

Comments
 (0)