astro-loader-hashnode
Version:
Astro content loader for seamlessly integrating Hashnode blog posts into your Astro website using the Content Layer API
79 lines (78 loc) • 2.18 kB
TypeScript
/**
* Series Loader - Handles Hashnode series
*/
import { BaseHashnodeLoader } from './base.js';
import type { SeriesLoaderOptions } from '../types/loader.js';
import type { HashnodeSeries } from '../types/hashnode.js';
/**
* Series Loader Class
*/
export declare class SeriesLoader extends BaseHashnodeLoader {
private options;
constructor(options: SeriesLoaderOptions);
/**
* Fetch series data from Hashnode API
*/
protected fetchData(): Promise<HashnodeSeries[]>;
/**
* Transform Hashnode series to Astro content format
*/
protected transformItem(series: HashnodeSeries): {
name: string;
slug: string;
description: string;
createdAt: Date;
updatedAt: Date;
coverImage: {
url: string;
} | undefined;
seo: {
title: string;
description: string;
};
author: {
id: string;
name: string;
username: string;
profilePicture: string;
bio: string;
followersCount: number;
} | undefined;
posts: {
id: string;
title: string;
slug: string;
brief: string;
publishedAt: Date;
readTimeInMinutes: number;
views: number;
url: string | undefined;
coverImage: {
url: string;
isPortrait: boolean;
} | undefined;
author: {
name: string;
username: string;
profilePicture: string;
};
}[];
sortOrder: string;
raw: {
id: string;
cuid: string | undefined;
};
};
/**
* Generate ID for series (prefer slug over cuid over id)
*/
protected generateId(series: HashnodeSeries): string;
}
/**
* Create a series loader
*/
export declare function createSeriesLoader(options: SeriesLoaderOptions): SeriesLoader;
/**
* Create an Astro Loader for series
*/
export declare function seriesLoader(options: SeriesLoaderOptions): import("astro/loaders").Loader;