UNPKG

astro-loader-hashnode

Version:

Astro content loader for seamlessly integrating Hashnode blog posts into your Astro website using the Content Layer API

70 lines (69 loc) 1.82 kB
/** * Search Loader - Handles Hashnode search functionality */ import { BaseHashnodeLoader } from './base.js'; import type { SearchLoaderOptions } from '../types/loader.js'; import type { HashnodePost } from '../types/hashnode.js'; /** * Search Loader Class */ export declare class SearchLoader extends BaseHashnodeLoader { private options; constructor(options: SearchLoaderOptions); /** * Fetch search results from Hashnode API */ protected fetchData(): Promise<Array<{ post: HashnodePost; searchTerm: string; }>>; /** * Transform search result to Astro content format */ protected transformItem(result: { post: HashnodePost; searchTerm: string; }): { id: string; title: string; brief: string; slug: string; url: string | undefined; searchTerm: string; searchRelevance: number; publishedAt: Date; reactionCount: number; views: number; author: { id: string; name: string; username: string; profilePicture: string; }; coverImage: { url: string; } | undefined; publication: { title: string; url: string; } | undefined; raw: { cuid: string | undefined; }; }; /** * Generate ID for search result */ protected generateId(result: { post: HashnodePost; searchTerm: string; }): string; } /** * Create a search loader */ export declare function createSearchLoader(options: SearchLoaderOptions): SearchLoader; /** * Create an Astro Loader for search */ export declare function searchLoader(options: SearchLoaderOptions): import("astro/loaders").Loader;