Zum Inhalt springen

@studiocms/blog

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

This plugin enables the StudioCMS Blog features as well as a frontend in your Astro project. It will allow you to create, edit, and delete blog posts from the StudioCMS dashboard.

This integration will add the following new routes to your StudioCMS-controlled front-end:

  • /[...slug] - Catch-all route rendering generic StudioCMS pages.
  • /blog - Blog index listing all posts.
  • /blog/[slug] - The individual blog post page.
  • /rss.xml - The RSS feed for your blog posts.
  1. Install the package using the following command:

    Terminal-Fenster
    npm run studiocms add @studiocms/blog
  2. Your StudioCMS config should now include @studiocms/blog:

    studiocms.config.mjs
    import { defineStudioCMSConfig } from 'studiocms/config';
    import blog from '@studiocms/blog';
    export default defineStudioCMSConfig({
    plugins: [
    blog(/* Options */),
    ],
    });
type StudioCMSBlogOptions = {
/**
* HTML Default Language - The default language for the HTML tag
* @default 'en'
*/
htmlDefaultLanguage: string | undefined;
/**
* HTML Default Header - The default head configuration for the Frontend
*/
htmlDefaultHead: {
/**
* Name of the HTML tag to add to `<head>`, e.g. `'meta'`, `'link'`, or `'script'`.
*/
tag: "link" | "title" | "base" | "style" | "meta" | "script" | "noscript" | "template";
/**
* Attributes to set on the tag, e.g. `{ rel: 'stylesheet', href: '/custom.css' }`.
*/
attrs?: Record<string, string | boolean | undefined> | undefined;
/**
* Content to place inside the tag (optional).
*/
content?: string | undefined;
}[] | undefined;
/**
* Favicon Configuration - The default favicon configuration for the Frontend
*/
favicon: string | undefined;
/**
* Enable sitemap generation
* @default true
*/
sitemap: boolean | undefined;
/**
* Inject routes
* @default true
*/
injectRoutes: boolean | undefined;
/**
* The configuration for the blog
*/
blog: {
/**
* The title of the blog
*/
title: string | undefined;
/**
* Enable RSS feed
*/
enableRSS: boolean | undefined;
/**
* The route for the blog
* @default '/blog'
* @example '/news'
*/
route: string | undefined;
} | undefined;
}