diff --git a/docs/site/docusaurus.config.js b/docs/site/docusaurus.config.js
index 5760ff48882b1..d007ea0a7bd06 100644
--- a/docs/site/docusaurus.config.js
+++ b/docs/site/docusaurus.config.js
@@ -89,6 +89,7 @@ const config = {
},
path.resolve(__dirname, `./src/plugins/descriptions`),
path.resolve(__dirname, `./src/plugins/framework`),
+ path.resolve(__dirname, `./src/plugins/askcookbook`),
],
presets: [
[
diff --git a/docs/site/src/plugins/askcookbook/index.js b/docs/site/src/plugins/askcookbook/index.js
new file mode 100644
index 0000000000000..5a4b7e81dfaee
--- /dev/null
+++ b/docs/site/src/plugins/askcookbook/index.js
@@ -0,0 +1,44 @@
+// Copyright (c) Mysten Labs, Inc.
+// SPDX-License-Identifier: Apache-2.0
+
+// It is going to be exposed in HTTP requests anyway, so it's fine to just hardcode it here.
+const COOKBOOK_PUBLIC_API_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NjU5ODBiNDAwZTliZDQ2MzcwZDlhNzYiLCJpYXQiOjE3MTcxNDE2ODQsImV4cCI6MjAzMjcxNzY4NH0.0JCgi4bJ_f6ILFgEyYAP-KeCm1dzOKwH30tC3jEs2_A";
+
+async function askCookbookPlugin() {
+ return {
+ name: "askCookbook",
+ injectHtmlTags() {
+ return {
+ postBodyTags: [
+ {
+ tagName: "div",
+ attributes: {
+ id: "__cookbook",
+ "data-api-key": COOKBOOK_PUBLIC_API_KEY,
+ },
+ },
+ `
+
+ `,
+ ],
+ };
+ },
+ };
+};
+
+module.exports = askCookbookPlugin;
diff --git a/docs/site/src/theme/SearchBar/index.js b/docs/site/src/theme/SearchBar/index.js
new file mode 100644
index 0000000000000..7f23d172fd1a3
--- /dev/null
+++ b/docs/site/src/theme/SearchBar/index.js
@@ -0,0 +1,24 @@
+// Copyright (c) Mysten Labs, Inc.
+// SPDX-License-Identifier: Apache-2.0
+
+import React from "react";
+import SearchBar from "@theme-original/SearchBar";
+
+export default class SearchBarWrapper extends React.Component {
+ componentDidMount() {
+ try {
+ window.initCookbook();
+ } catch (e) {
+ // Gracefully ignore errors if something goes wrong
+ console.error("Erorr initializing Ask Cookbook", e);
+ }
+ }
+
+ render() {
+ return (
+ <>
+
+ >
+ );
+ }
+}