Data Types and Article Shape
Data Types and Article Shape
All of these types are importable from @rankhiker/sdk:
import type {
RankHikerArticle,
RankHikerArticleSummary,
RankHikerAuthor,
RankHikerTocItem,
RankHikerFaqItem,
ListArticlesResponse,
GetArticleResponse,
} from '@rankhiker/sdk';
RankHikerArticleSummary
Returned by listArticles, listArticlesRaw (inside articles), and getArticleById. It includes the full HTML content but omits the toc, faq, and key takeaways.
| Field | Type | Notes |
|---|---|---|
id | string | Article id. |
title | string | Article title. |
slug | string | URL slug. |
content | string | Full article body as HTML (see note below). |
excerpt | string | Short summary. |
metaDescription | string | SEO meta description. |
focusKeyword | string | Primary SEO keyword. |
tags | string[] | Article tags. |
featuredImage | string (optional) | Cover image URL. |
readingTime | number | Estimated minutes to read. |
author | RankHikerAuthor | Author name and avatar. |
publishedAt | string (optional) | ISO publish date. |
publishedUrl | string (optional) | Canonical published URL. |
originalUrl | string (optional) | Backward-compat alias of publishedUrl. |
Extends RankHikerArticleSummary with the fields below. Returned only by getArticleBySlug.
| Field | Type | Notes |
|---|---|---|
tableOfContents | RankHikerTocItem[] | Heading outline. |
faq | RankHikerFaqItem[] | Question / answer pairs. |
keyTakeaways | string[] | Bullet summary. |
views | number | View count. |
wordCount | number | Total words. |
| Field | Type |
|---|---|
name | string |
avatar | string |
| Field | Type |
|---|---|
id | string |
title | string |
level | number |
| Field | Type |
|---|---|
question | string |
answer | string |
listArticlesRaw and the slug endpoint both return an envelope with a syncedAt cursor.
interface ListArticlesResponse {
articles: RankHikerArticleSummary[];
syncedAt: string;
}
interface GetArticleResponse {
article: RankHikerArticle;
syncedAt: string;
}
listArticles unwraps to articles, and getArticleBySlug unwraps to article (or null). Use listArticlesRaw when you need syncedAt.
Content is HTML
content is the article body produced by the RankHiker editor, delivered as HTML, not Markdown. The React renders it with dangerouslySetInnerHTML and the Vue renders it with innerHTML.
If your articles are stored as Markdown, convert to HTML before rendering (for example with marked), or supply a custom renderer (the render prop in React or the default slot in Vue) to handle the body yourself.
Was this article helpful?