@studiocms/blog
Présentation
Section intitulée « Présentation »Ce module d’extension active les fonctionnalités du blog StudioCMS ainsi qu’un front-end dans votre projet Astro. Il vous permettra de créer, modifier et supprimer des articles de blog depuis le tableau de bord de StudioCMS.
Installation
Section intitulée « Installation »-
Installez le paquet à l’aide de la commande suivante :
Fenêtre de terminal npm run studiocms add @studiocms/blogFenêtre de terminal pnpm run studiocms add @studiocms/blogFenêtre de terminal yarn run studiocms add @studiocms/blog -
Votre configuration StudioCMS devrait désormais inclure
@studiocms/blog
: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.
],});
Utilisation
Section intitulée « Utilisation »Que fait ce module d’extension ?
Section intitulée « Que fait ce module d’extension ? »Cette intégration ajoutera les nouvelles routes suivantes à votre front-end contrôlé par StudioCMS :
/[...slug]
- La page principale du blog qui répertorie toutes les pages StudioCMS./blog
- La page principale du blog qui répertorie tous les articles du blog./blog/[slug]
- La page de l’article de blog individuel./rss.xml
- Le flux RSS de vos articles de blog.