feat(route): add bvisness.me blog route (#20929)

This commit is contained in:
Radon Rosborough
2026-01-21 00:36:03 +00:00
committed by GitHub
parent 04330df386
commit 685598f0f8
2 changed files with 49 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import { load } from 'cheerio';
import type { Route } from '@/types';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
export const route: Route = {
name: 'Blog',
categories: ['blog'],
maintainers: ['raxod502'],
path: '/blog',
example: '/bvisness/blog',
handler,
radar: [
{
source: ['bvisness.me'],
target: '/blog',
},
],
};
async function handler() {
const response = await ofetch('https://bvisness.me/');
const $ = load(response);
const items = $('article')
.toArray()
.map((item) => {
item = $(item);
const a = item.find('a').first();
return {
title: a.text(),
link: new URL(a.attr('href'), 'https://bvisness.me/').href,
pubDate: parseDate(item.find('time').attr('datetime')),
};
});
return {
title: 'Ben Visness Blog',
link: 'https://bvisness.me/',
item: items,
};
}
+6
View File
@@ -0,0 +1,6 @@
import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'Ben Visness',
url: 'bvisness.me',
};