@studiocms/blog
Einführung
'Read the “', Einführung, '” section'Dieses Plugin aktiviert die StudioCMS Blog-Funktionen sowie ein Frontend in deinem Astro-Projekt. Es ermöglicht dir, Blogbeiträge über das StudioCMS-Dashboard zu erstellen, zu bearbeiten und zu löschen.
Installation
'Read the “', Installation, '” section'-
Installiere das Paket mit dem folgenden Befehl:
Terminal-Fenster npm i @studiocms/blogTerminal-Fenster pnpm add @studiocms/blogTerminal-Fenster yarn add @studiocms/blog -
Füge
@studiocms/blog
zu deiner Astro-Konfigurationsdatei hinzu:studiocms.config.mjs import {defineStudioCMSConfig } from 'studiocms/config';function defineStudioCMSConfig(config: StudioCMSOptions): {sdk?: boolean | {cacheConfig?: boolean | {lifetime?: string | undefined;} | undefined;} | undefined;dbStartPage?: boolean | undefined;imageService?: {cdnPlugin?: "cloudinary-js" | undefined;} | undefined;defaultFrontEndConfig?: boolean | {htmlDefaultLanguage?: string | undefined;htmlDefaultHead?: {tag: "link" | "title" | "base" | "style" | "meta" | "script" | "noscript" | "template";attrs?: Record<string, string | boolean | undefined> | undefined;content?: string | undefined;}[] | undefined;favicon?: string | undefined;injectQuickActionsMenu?: boolean | undefined;} | undefined;dashboardConfig?: {dashboardEnabled?: boolean | undefined;inject404Route?: boolean | undefined;faviconURL?: string | undefined;dashboardRouteOverride?: string | undefined;AuthConfig?: {providers?: {github?: boolean | undefined;discord?: boolean | undefined;google?: boolean | undefined;auth0?: boolean | undefined;usernameAndPassword?: boolean | undefined;usernameAndPasswordConfig?: {allowUserRegistration?: boolean | undefined;} | undefined;} | undefined;enabled?: boolean | undefined;} | undefined;developerConfig?: {demoMode?: false | {password: string ...A 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.mjs
file.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): {sdk?: boolean | {cacheConfig?: boolean | {lifetime?: string | undefined;} | undefined;} | undefined;dbStartPage?: boolean | undefined;imageService?: {cdnPlugin?: "cloudinary-js" | undefined;} | undefined;defaultFrontEndConfig?: boolean | {htmlDefaultLanguage?: string | undefined;htmlDefaultHead?: {tag: "link" | "title" | "base" | "style" | "meta" | "script" | "noscript" | "template";attrs?: Record<string, string | boolean | undefined> | undefined;content?: string | undefined;}[] | undefined;favicon?: string | undefined;injectQuickActionsMenu?: boolean | undefined;} | undefined;dashboardConfig?: {dashboardEnabled?: boolean | undefined;inject404Route?: boolean | undefined;faviconURL?: string | undefined;dashboardRouteOverride?: string | undefined;AuthConfig?: {providers?: {github?: boolean | undefined;discord?: boolean | undefined;google?: boolean | undefined;auth0?: boolean | undefined;usernameAndPassword?: boolean | undefined;usernameAndPasswordConfig?: {allowUserRegistration?: boolean | undefined;} | undefined;} | undefined;enabled?: boolean | undefined;} | undefined;developerConfig?: {demoMode?: false | {password: string ...A 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.mjs
file.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: [plugins?: StudioCMSPlugin[] | undefinedblog(),function blog(options?: StudioCMSBlogOptions): StudioCMSPluginCreates and configures the StudioCMS Blog plugin.
],});
Verwendung
'Read the “', Verwendung, '” section'Was macht dieses Plugin?
'Read the “', Was macht dieses Plugin?, '” section'Diese Integration fügt deinem StudioCMS-gesteuerten Frontend die folgenden neuen Routen hinzu:
/[...slug]
- Die Hauptblogseite, die alle StudioCMS-Seiten auflistet./blog
- Die Hauptblogseite, die alle Blogbeiträge auflistet./blog/[slug]
- Die Seite mit den einzelnen Blogbeiträgen./rss.xml
- Der RSS-Feed für deine Blogbeiträge.