Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions .github/scripts/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def resolve_file(slug: str) -> Optional[str]:
str(Path(slug) / "index.mdx"),
str(Path(slug) / "index.md"),
):
if (REPO_ROOT / rel).exists():
return rel
if (REPO_ROOT / 'content' / rel).exists():
return 'content' / rel
return None


Expand Down
23 changes: 22 additions & 1 deletion content/meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
{
"$schema": "../meta-schema.json",
"pages": [
"start-here",
"get-support",
"from-ethereum",
"more-tutorials",
"!old",
"external:[Old documentation](https://old-docs.ton.org/)",
"..."
"---Ecosystem---",
"...ecosystem",
"---Payment processing---",
"...payments",
"---Standard contracts---",
"...standard",
"---Contract development---",
"...contract-dev",
"---Tolk language---",
"...tolk",
"---TVM: TON Virtual Machine---",
"...tvm",
"---Blockchain foundations---",
"...foundations",
"---Legacy languages---",
"...languages",
"---Contributing---",
"...contribute"
]
}
14 changes: 6 additions & 8 deletions source.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
remarkMdxFiles,
remarkGfm,
} from 'fumadocs-core/mdx-plugins';
import {parseCodeBlockAttributes} from "fumadocs-core/mdx-plugins/codeblock-utils"
import { parseCodeBlockAttributes } from "fumadocs-core/mdx-plugins/codeblock-utils"
import { z } from "zod";
import {
transformerMetaHighlight,
Expand Down Expand Up @@ -140,14 +140,12 @@ export default defineConfig({
if (base.length === 0) return
if (!base.startsWith('/')) return;
visitParents(tree, 'element', (node) => {
try {
for (const attr of ['src', 'darkSrc', 'href', 'poster']) {
const value = node.properties?.[attr];
if (typeof value === 'string' && value.startsWith('/')) {
node.properties[attr] = base.replace(/\/*$/, '') + '/' + value.replace(/^\/*/, '');
}
for (const attr of ['src', 'darkSrc', 'href', 'poster']) {
const value = node.properties?.[attr];
if (typeof value === 'string' && value.startsWith('/') && !value.startsWith(base)) {
node.properties[attr] = base.replace(/\/*$/, '') + '/' + value.replace(/^\/*/, '');
}
} catch (_) { }
}
});
};
},
Expand Down
14 changes: 14 additions & 0 deletions src/app/api/search/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ const searchSource: typeof source = {
const searchAPI = createFromSource(searchSource, {
// https://docs.orama.com/docs/orama-js/supported-languages
language: 'english',
// buildIndex(page) {
// return {
// id: page.url,
// url: page.url,
// title: page.data.title,
// description: page.data.description,
// structuredData: page.data.structuredData,
// tag: page.slugs[0],
// // TODO: redirects for /-based folder paths to overview pages.
// }
// },
sort: {
enabled: true,
}
});

export const revalidate = false;
Expand Down
11 changes: 11 additions & 0 deletions src/components/search.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
'use client';
import { useState } from 'react';
import {
SearchDialog,
SearchDialogClose,
SearchDialogContent,
SearchDialogHeader,
SearchDialogFooter,
SearchDialogIcon,
SearchDialogInput,
SearchDialogList,
SearchDialogOverlay,
type SharedProps,
TagsList,
TagsListItem,
} from 'fumadocs-ui/components/dialog/search';
import { useDocsSearch } from 'fumadocs-core/search/client';
import { create } from '@orama/orama';
Expand All @@ -23,6 +27,7 @@ function initOrama() {
}

export default function DefaultSearchDialog(props: SharedProps) {
const [tag, setTag] = useState<string | undefined>();
const { locale } = useI18n(); // (optional) for i18n
const { search, setSearch, query } = useDocsSearch(
process.env.NEXT_CONFIG === 'vercel'
Expand All @@ -35,6 +40,7 @@ export default function DefaultSearchDialog(props: SharedProps) {
initOrama,
locale,
from: `${process.env.NEXT_PUBLIC_BASE_PATH ?? ''}/api/search`,
// tag,
}
);

Expand All @@ -48,6 +54,11 @@ export default function DefaultSearchDialog(props: SharedProps) {
<SearchDialogClose />
</SearchDialogHeader>
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
{/* <SearchDialogFooter className="flex flex-row">
<TagsList tag={tag} onTagChange={setTag}>
<TagsListItem value="my-value">My Value</TagsListItem>
</TagsList>
</SearchDialogFooter> */}
</SearchDialogContent>
</SearchDialog>
);
Expand Down