@studiocms/blog
Este complemento habilita las características del Blog de StudioCMS así como, un frontend en tu proyecto Astro. Te permitirá crear, editar y eliminar publicaciones de blog desde el panel de control de StudioCMS.
Este complemento requiere el complemento @studiocms/md.
¿Qué hace este complemento?
Sección titulada «¿Qué hace este complemento?»Esta integración agregará las siguientes nuevas rutas a tu frontend controlado por StudioCMS:
/[...slug]- Ruta de catch-all que renderiza páginas genéricas de StudioCMS./blog- Índice del blog que lista todas las publicaciones./blog/[slug]- La página de la publicación individual del blog./rss.xml- El feed RSS para tus publicaciones de blog.
Instalación
Sección titulada «Instalación»-
Instala el paquete usando el siguiente comando:
Ventana de terminal npm run studiocms add @studiocms/blogVentana de terminal pnpm run studiocms add @studiocms/blogVentana de terminal yarn run studiocms add @studiocms/blog -
Tu configuración de StudioCMS ahora debe incluir
@studiocms/blog:studiocms.config.mjs import {defineStudioCMSConfig } from 'studiocms/config';function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptionsA utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is
studiocms.config.mjs. And it should be adjacent to the Astro project'sastro.config.mjsfile.StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.
Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.
importblog from '@studiocms/blog';function blog(options?: StudioCMSBlogOptions): StudioCMSPluginCreates and configures the StudioCMS Blog plugin.
export defaultdefineStudioCMSConfig({function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptionsA utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is
studiocms.config.mjs. And it should be adjacent to the Astro project'sastro.config.mjsfile.StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.
Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.
plugins: [StudioCMSOptions.plugins?: StudioCMSPlugin[]Add Plugins to the StudioCMS
blog(/* Opciones */),function blog(options?: StudioCMSBlogOptions): StudioCMSPluginCreates and configures the StudioCMS Blog plugin.
],});
Opciones
Sección titulada «Opciones»type StudioCMSBlogOptions = { /** * Lenguaje HTML por defecto - El lenguaje por defecto para la etiqueta HTML * @default 'en' */ htmlDefaultLanguage: string | undefined; /** * Encabezado HTML por defecto - La configuración de encabezado por defecto para el frontend */ htmlDefaultHead: { /** * Nombre de la etiqueta HTML para agregar a `<head>`, ej. `'meta'`, `'link'`, o `'script'`. */ tag: "link" | "title" | "base" | "style" | "meta" | "script" | "noscript" | "template"; /** * Atributos para establecer en la etiqueta, ej. `{ rel: 'stylesheet', href: '/custom.css' }`. */ attrs?: Record<string, string | boolean | undefined> | undefined; /** * Contenido para colocar dentro de la etiqueta (opcional). */ content?: string | undefined; }[] | undefined; /** * Configuración del Favicon - La configuración del favicon por defecto para el frontend */ favicon: string | undefined; /** * Habilitar la generación de sitemap * @default true */ sitemap: boolean | undefined; /** * Inyectar rutas * @default true */ injectRoutes: boolean | undefined; /** * La configuración para el blog */ blog: { /** * El título del blog */ title: string | undefined; /** * Habilitar el feed RSS */ enableRSS: boolean | undefined; /** * La ruta para el blog * @default '/blog' * @example '/noticias' */ route: string | undefined; } | undefined;}