mirror of
https://github.com/github/awesome-copilot.git
synced 2026-09-19 04:56:41 +00:00
chore: publish from main
This commit is contained in:
@@ -41,6 +41,19 @@ const TYPE_PAGES: Record<string, string> = {
|
||||
tool: "/tools/",
|
||||
};
|
||||
|
||||
// Resource types that have a dedicated detail page at /<type>/<id>/. Search
|
||||
// results for these should deep-link to the canonical detail page rather than
|
||||
// the listing page with an inert #file= hash (listing pages no longer open a
|
||||
// modal from that hash).
|
||||
const DETAIL_ROUTE_TYPES = new Set([
|
||||
"agent",
|
||||
"instruction",
|
||||
"skill",
|
||||
"hook",
|
||||
"workflow",
|
||||
"plugin",
|
||||
]);
|
||||
|
||||
export default function pagefindResources(): AstroIntegration {
|
||||
let siteBase = "/";
|
||||
|
||||
@@ -97,12 +110,17 @@ export default function pagefindResources(): AstroIntegration {
|
||||
|
||||
let added = 0;
|
||||
for (const record of records) {
|
||||
const hasDetailPage =
|
||||
DETAIL_ROUTE_TYPES.has(record.type) && Boolean(record.id);
|
||||
const typePage = TYPE_PAGES[record.type];
|
||||
if (!typePage) continue;
|
||||
// Skip records we can neither deep-link nor point at a listing page.
|
||||
if (!hasDetailPage && !typePage) continue;
|
||||
|
||||
const url = `${base}${typePage.slice(1)}#file=${encodeURIComponent(
|
||||
record.path
|
||||
)}`;
|
||||
const url = hasDetailPage
|
||||
? `${base}${record.type}/${encodeURIComponent(record.id)}/`
|
||||
: `${base}${typePage.slice(1)}#file=${encodeURIComponent(
|
||||
record.path
|
||||
)}`;
|
||||
const typeLabel = TYPE_LABELS[record.type] || record.type;
|
||||
|
||||
const addResult = await index.addCustomRecord({
|
||||
|
||||
Reference in New Issue
Block a user