feat(route): add watasuke.net (#14629)
* feat: add watasuke.net * feat: add mdx docs * feat: get data from og:description * feat: add feed items * refactor: migrate to v3 ---------
This commit is contained in:
parent
18ca90926f
commit
9a41023746
|
|
@ -0,0 +1,42 @@
|
|||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import markdownit from 'markdown-it';
|
||||
|
||||
import { Route } from '@/types';
|
||||
|
||||
const handler = async () => {
|
||||
const baseUrl = 'https://watasuke.net';
|
||||
const apiUrl = `${baseUrl}/page-data/blog/page-data.json`;
|
||||
const response = await got(apiUrl);
|
||||
const md = markdownit({ linkify: true, breaks: true });
|
||||
const articles = response.data.result.data.allArticles.nodes.map((node) => ({
|
||||
title: node.title,
|
||||
description: md.render(node.body),
|
||||
pubDate: parseDate(node.published_at),
|
||||
updated: parseDate(node.updated_at),
|
||||
link: `${baseUrl}/blog/article/${node.slug}/`,
|
||||
category: node.tags.map((tag) => tag.name),
|
||||
}));
|
||||
|
||||
return {
|
||||
title: 'ブログ - わたすけのへや' || baseUrl,
|
||||
link: `${baseUrl}/blog/`,
|
||||
item: articles,
|
||||
language: 'ja',
|
||||
icon: `${baseUrl}/icons/icon-512x512.png`,
|
||||
logo: `${baseUrl}/icons/icon-512x512.png`,
|
||||
};
|
||||
};
|
||||
export const route: Route = {
|
||||
path: '/blog',
|
||||
example: '/watasuke/blog',
|
||||
radar: [
|
||||
{
|
||||
source: ['watasuke.net/blog/', 'watasuke.net/'],
|
||||
},
|
||||
],
|
||||
name: 'Blog',
|
||||
maintainers: ['honahuku'],
|
||||
handler,
|
||||
url: 'watasuke.net/blog/',
|
||||
};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'Watasuke',
|
||||
url: 'watasuke.net',
|
||||
categories: ['blog'],
|
||||
};
|
||||
Loading…
Reference in New Issue