Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary fix: Search with google #1233

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions _components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Logo from "./Logo.tsx";

import SearchInput from "./SearchInput.tsx";
export default function Header({
url,
hasSidebar,
Expand Down Expand Up @@ -90,8 +90,7 @@ export default function Header({
hideOnMobile
/>
<div class="min-w-[150px] md:w-32 xl:w-64">
<orama-search-button />
<orama-search-box />
<SearchInput />
</div>
<div class="dark-mode-toggle">
<button class="dark-mode-toggle button p-1 rounded bg-background-primary ring ring-transparent hover:ring-foreground-tertiary">
Expand Down
31 changes: 31 additions & 0 deletions _components/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export default function SearchInput() {
return (
<form action="https://www.google.com/search" method="get" class="search">
<input type="hidden" name="q" id="q" value="site:https://deno.com" />
<input
type="search"
name="q"
id="search-str"
placeholder="Search"
className="
w-full
lg:flex
rounded-lg
items-center
text-sm
leading-6
py-1.5 pl-2 pr-3
border
text-slate-600
bg-slate-100
dark:bg-background-secondary
dark:text-slate-200
dark:highlight-white/5
dark:hover:bg-slate-700
dark:border-foreground-tertiary
hover:bg-slate-200
duration-150 ease-in-out"
/>
</form>
);
}
63 changes: 0 additions & 63 deletions _config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ import codeblockCopyPlugin from "./markdown-it/codeblock-copy.ts";
import codeblockTitlePlugin from "./markdown-it/codeblock-title.ts";
import relativeLinksPlugin from "./markdown-it/relative-path.ts";
import replacerPlugin from "./markdown-it/replacer.ts";
import {
clear as oramaClear,
deploy as oramaDeploy,
generateDocumentsForExamples,
generateDocumentsForPage,
generateDocumentsForSymbols,
notify as oramaNotify,
OramaDocument,
} from "./orama.ts";

import apiDocumentContentTypeMiddleware from "./middleware/apiDocContentType.ts";
import createRoutingMiddleware from "./middleware/functionRoutes.ts";
import createGAMiddleware from "./middleware/googleAnalytics.ts";
Expand Down Expand Up @@ -209,54 +199,6 @@ site.process([".html"], (pages) => {
}
});

const ORAMA_API_KEY = Deno.env.get("ORAMA_CLOUD_API_KEY");
const ORAMA_INDEX_ID = Deno.env.get("ORAMA_CLOUD_INDEX_ID");
if (ORAMA_API_KEY && ORAMA_INDEX_ID) {
site.process([".html"], async (pages) => {
let pageEntries: OramaDocument[] = [];

await oramaClear(ORAMA_API_KEY, ORAMA_INDEX_ID);

for (const page of pages) {
if (
page.document &&
(page.data.url.startsWith("/runtime/") ||
page.data.url.startsWith("/deploy/") ||
page.data.url.startsWith("/subhosting/"))
) {
pageEntries = pageEntries.concat(generateDocumentsForPage(page));
}
}

await oramaNotify(ORAMA_API_KEY, ORAMA_INDEX_ID, pageEntries, "pages");

await oramaNotify(
ORAMA_API_KEY,
ORAMA_INDEX_ID,
await generateDocumentsForExamples(),
"examples",
);

try {
await oramaNotify(
ORAMA_API_KEY,
ORAMA_INDEX_ID,
await generateDocumentsForSymbols(),
"symbols",
);
} catch (e) {
console.warn(
"⚠️ Orama documents for reference docs were not generated.",
e,
);
}

await oramaDeploy(ORAMA_API_KEY, ORAMA_INDEX_ID);
});
} else {
console.warn("⚠️ Orama documents were not generated.");
}

site.ignore(
"old",
"README.md",
Expand All @@ -279,9 +221,4 @@ site.use(
}),
);

site.remoteFile(
"orama.css",
"https://unpkg.com/@orama/[email protected]/dist/orama-ui/orama-ui.css",
);
site.copy("orama.css");
export default site;
2 changes: 0 additions & 2 deletions _includes/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ export default function Layout(props: Lume.Data) {
<link rel="stylesheet" href="/overrides.css" />
<script src="/darkmode.client.js"></script>
<script type="module" src="/darkmode-toggle.client.js"></script>
<link rel="stylesheet" href="/orama.css" />
<script type="module" src="/sidebar.client.js"></script>
<script type="module" src="/copy.client.js"></script>
<script type="module" src="/search.client.js"></script>
<script type="module" src="/tabs.client.js"></script>
<script type="module" src="/feedback.client.js"></script>
<script
Expand Down
2 changes: 0 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"imports": {
"@orama/wc-components/": "https://unpkg.com/@orama/[email protected]/",
"@std/assert": "jsr:@std/assert@^1.0.6",
"@std/dotenv": "jsr:@std/dotenv@^0.225.2",
"@std/fs": "jsr:@std/fs@^0.229.3",
Expand All @@ -9,7 +8,6 @@
"@std/path": "jsr:@std/path@^1.0.8",
"ga4": "https://raw.githubusercontent.com/denoland/ga4/04a1ce209116f158b5ef1658b957bdb109db68ed/mod.ts",
"lume/": "https://deno.land/x/[email protected]/",
"@orama/wc-components/": "https://unpkg.com/@orama/[email protected]/",
"googleapis": "npm:googleapis@^144.0.0",
"prismjs": "npm:[email protected]",
"tailwindcss": "npm:tailwindcss@^3.4.9"
Expand Down
189 changes: 0 additions & 189 deletions orama.ts

This file was deleted.

Loading
Loading