Skip to content

Commit d901fed

Browse files
authored
Merge pull request #80 from ten-protocol/llms-txt-plugin
Added AI search & chat functionality
2 parents 7b7ea93 + 15863fc commit d901fed

File tree

14 files changed

+406
-5
lines changed

14 files changed

+406
-5
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Mendable configuration
2+
MENDABLE_ANON_KEY=649b6b45-ca17-468b-9f7b-3316c106cc7f

docusaurus.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// @ts-check
22
// Note: type annotations allow type checking and IDEs autocompletion
33

4+
require('dotenv').config();
5+
46
const {themes} = require('prism-react-renderer');
57
const lightTheme = themes.github;
68
const darkTheme = themes.dracula;
@@ -33,6 +35,11 @@ const config = {
3335
locales: ['en'],
3436
},
3537

38+
// Add Mendable configuration
39+
customFields: {
40+
mendableAnonKey: process.env.MENDABLE_ANON_KEY || 'YOUR_ANON_KEY',
41+
},
42+
3643
presets: [
3744
[
3845
'classic',

env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Mendable configuration
2+
MENDABLE_ANON_KEY=YOUR_ANON_KEY

package-lock.json

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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
"@docusaurus/core": "^3.8.1",
1818
"@docusaurus/preset-classic": "^3.8.1",
1919
"@mdx-js/react": "^3.0.0",
20+
"@mendable/search": "^0.0.206",
2021
"@signalwire/docusaurus-plugin-llms-txt": "^1.2.0",
2122
"clsx": "^1.2.1",
23+
"dotenv": "^17.0.0",
2224
"prism-react-renderer": "^2.1.0",
2325
"react": "^18.2.0",
24-
"react-dom": "^18.2.0"
26+
"react-dom": "^18.2.0",
27+
"swizzle": "^1.1.0"
2528
},
2629
"devDependencies": {
2730
"@docusaurus/module-type-aliases": "3.0.0"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
export default function FooterCopyright({copyright}) {
3+
return (
4+
<div
5+
className="footer__copyright"
6+
// Developer provided the HTML, so assume it's safe.
7+
// eslint-disable-next-line react/no-danger
8+
dangerouslySetInnerHTML={{__html: copyright}}
9+
/>
10+
);
11+
}

src/theme/Footer/Layout/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import {ThemeClassNames} from '@docusaurus/theme-common';
4+
export default function FooterLayout({style, links, logo, copyright}) {
5+
return (
6+
<footer
7+
className={clsx(ThemeClassNames.layout.footer.container, 'footer', {
8+
'footer--dark': style === 'dark',
9+
})}>
10+
<div className="container container-fluid">
11+
{links}
12+
{(logo || copyright) && (
13+
<div className="footer__bottom text--center">
14+
{logo && <div className="margin-bottom--sm">{logo}</div>}
15+
{copyright}
16+
</div>
17+
)}
18+
</div>
19+
</footer>
20+
);
21+
}

src/theme/Footer/LinkItem/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import Link from '@docusaurus/Link';
4+
import useBaseUrl from '@docusaurus/useBaseUrl';
5+
import isInternalUrl from '@docusaurus/isInternalUrl';
6+
import IconExternalLink from '@theme/Icon/ExternalLink';
7+
export default function FooterLinkItem({item}) {
8+
const {to, href, label, prependBaseUrlToHref, className, ...props} = item;
9+
const toUrl = useBaseUrl(to);
10+
const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
11+
return (
12+
<Link
13+
className={clsx('footer__link-item', className)}
14+
{...(href
15+
? {
16+
href: prependBaseUrlToHref ? normalizedHref : href,
17+
}
18+
: {
19+
to: toUrl,
20+
})}
21+
{...props}>
22+
{label}
23+
{href && !isInternalUrl(href) && <IconExternalLink />}
24+
</Link>
25+
);
26+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import {ThemeClassNames} from '@docusaurus/theme-common';
4+
import LinkItem from '@theme/Footer/LinkItem';
5+
function ColumnLinkItem({item}) {
6+
return item.html ? (
7+
<li
8+
className={clsx('footer__item', item.className)}
9+
// Developer provided the HTML, so assume it's safe.
10+
// eslint-disable-next-line react/no-danger
11+
dangerouslySetInnerHTML={{__html: item.html}}
12+
/>
13+
) : (
14+
<li key={item.href ?? item.to} className="footer__item">
15+
<LinkItem item={item} />
16+
</li>
17+
);
18+
}
19+
function Column({column}) {
20+
return (
21+
<div
22+
className={clsx(
23+
ThemeClassNames.layout.footer.column,
24+
'col footer__col',
25+
column.className,
26+
)}>
27+
<div className="footer__title">{column.title}</div>
28+
<ul className="footer__items clean-list">
29+
{column.items.map((item, i) => (
30+
<ColumnLinkItem key={i} item={item} />
31+
))}
32+
</ul>
33+
</div>
34+
);
35+
}
36+
export default function FooterLinksMultiColumn({columns}) {
37+
return (
38+
<div className="row footer__links">
39+
{columns.map((column, i) => (
40+
<Column key={i} column={column} />
41+
))}
42+
</div>
43+
);
44+
}

0 commit comments

Comments
 (0)