JA
ベータ版の翻訳

@core / blog

1.0.1 ▾
認証済みMIT
GitHub

@core/content 上のブログ:記事、著者、カテゴリ、タグ、シリーズ、関連記事、アーカイブ、RSS/Atom/JSON フィード

コード7 ファイルコンテキスト約 554 トークンスキャン合格

.genpmignore 適用後に組み込まれる正確なツリーです。固定先:

src/lib/blog/sources.ts読み取り専用 · 8aaf3ee
// Fuentes de sitemap y buscador del blog, y recursos del panel.
import { contentAdminResource, contentSearchSource, contentSitemapSource } from '../content/index.ts';
import { type Doc, toPlainText } from '../rich-text/index.ts';
import { BLOG_COLLECTIONS } from './collections.ts';

type PathFn = (p: { slug: string; locale: string }) => string;
const defaultPath: PathFn = ({ slug }) => `/blog/${slug}`;

export const blogSitemapSource = (path: PathFn = defaultPath) => contentSitemapSource('posts', path);

/** Documentos de búsqueda con el cuerpo en texto plano. Los posts `membersOnly` solo indexan título y extracto. */
export const blogSearchSource = (path: PathFn = defaultPath) =>
  contentSearchSource('posts', {
    type: 'post',
    path,
    title: (d) => String(d.title ?? ''),
    text: (d) => (d.membersOnly ? String(d.excerpt ?? '') : `${d.excerpt ?? ''}\n${toPlainText(d.body as Doc)}`),
  });

/** Recursos del panel: posts (con enlaces "Ver" y "Vista previa"), autores, categorías, etiquetas y series. */
export const blogAdminResources = (path: PathFn = defaultPath) =>
  BLOG_COLLECTIONS.map((c) => ({ ...contentAdminResource(c, c === 'posts' ? { path } : {}), group: 'Blog' }));

@core/blog を報告

パッケージを報告するには GitHub でログインしてください。

GitHub で続ける