What is VitePress
VitePress is a lightweight static site generator based on Vue.
Get an API key
- Go to the Inkeep Dashboard
- Select your project under Projects
- Go to the Integrations tab
- Click on Create integration
- Select Web
- Provide a Name and URL (optional) for the integration
- Click on Create
- Click the Example < /> button to get your API key and view suggested settings
Copy and add the apiKey
, integrationId
and organizationId
to your environment variables:
VITE_INKEEP_API_KEY="INKEEP_API_KEY"
VITE_INKEEP_INTEGRATION_ID="INKEEP_INTEGRATION_ID"
VITE_INKEEP_ORGANIZATION_ID="INKEEP_ORGANIZATION_ID"
Load the script files
Add the below scripts to the config.ts
file:
export default {
head: [
[
"script",
{
src: "https://unpkg.com/@inkeep/uikit-js@0.3.18/dist/embed.js",
type: "module",
defer: true,
},
],
["script", { src: "static/addInkeep.js", type: "module", defer: true }],
],
};
Create the addInkeep.js script
Create an addInkeep.js
file in your static
folder.
touch static/addInkeep.js
Now, create a container and configure the search bar component.
Next, embed the widget using the Inkeep.embed()
function.
This will replace the default search bar used on the
website.
const config = {
componentType: "SearchBar",
targetElement: document.querySelector(".search"),
colorModeSync: {
observedElement: document.documentElement,
isDarkModeCallback: (el) => {
return el.classList.contains("dark");
},
colorModeAttribute: "class",
},
properties: {
baseSettings: {
apiKey: import.meta.env.VITE_INKEEP_API_KEY,
integrationId: import.meta.env.VITE_INKEEP_INTEGRATION_ID,
organizationId: import.meta.env.VITE_INKEEP_ORGANIZATION_ID,
primaryBrandColor: "#26D6FF",
organizationDisplayName: "Inkeep",
theme: {
},
},
modalSettings: {
},
searchSettings: {
},
aiChatSettings: {
botAvatarSrcUrl: "/img/logo.svg",
quickQuestions: [
"Example question 1?",
"Example question 2?",
"Example question 3?",
],
},
},
};
const inkeepWidget = Inkeep().embed(config);
For a full list of customizations, check out the Search Bar documentation.