Some cleanup, and change to how config options are

This commit is contained in:
Adam Matthiesen 2024-03-03 10:25:51 -08:00
parent 017e641afd
commit 65f3f2b019
3 changed files with 36 additions and 27 deletions

View File

@ -62,23 +62,26 @@ export default defineConfig({
integrations: [ integrations: [
GhostCMS({ GhostCMS({
// Config Options // Config Options
ghostURL: "http://example.com"; // Recommended to set here, Can also set in .env as CONTENT_API_URL ghostURL: "http://example.com", // Recommended to set here, Can also set in .env as CONTENT_API_URL
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled. ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
disableThemeProvider: false; // OPTIONAL - Default False disableThemeProvider: false, // OPTIONAL - Default False
theme: "@matthiesenxyz/astro-ghostcms-theme-default"; // OPTIONAL - Default Theme shown. theme: "@matthiesenxyz/astro-ghostcms-theme-default", // OPTIONAL - Default Theme shown.
}; };
disableDefault404: false; // Allows the user to disable the default `/404 page, to be able to create their own under `/src/pages/404.astro`. disableDefault404: false, // Allows the user to disable the default `/404 page, to be able to create their own under `/src/pages/404.astro`.
enableRSSFeed: true; // Allows the user to Enable or disable RSS Feed Generation. Default: true enableRSSFeed: true, // Allows the user to Enable or disable RSS Feed Generation. Default: true
enableOGImages: true; // Allows the user to Enable or disable OG Image Generation. Default: true enableOGImages: true, // Allows the user to Enable or disable OG Image Generation. Default: true
fullConsoleLogs: false; // Show the full Log output from All parts of Astro-GhostCMS fullConsoleLogs: false, // Show the full Log output from All parts of Astro-GhostCMS
robotsTxt: { Integrations: {
// OPTIONAL // This allows user config passthrough from Astro-GhostCMS to the Included Integrations
// ADVANCED USAGE - https://www.npmjs.com/package/astro-robots-txt#configuration robotsTxt: {
} // OPTIONAL
sitemap: { // ADVANCED USAGE - https://www.npmjs.com/package/astro-robots-txt#configuration
// OPTIONAL },
// ADVANCED USAGE - https://docs.astro.build/en/guides/integrations-guide/sitemap sitemap: {
} // OPTIONAL
// ADVANCED USAGE - https://docs.astro.build/en/guides/integrations-guide/sitemap
},
},
}) })
], ],
}); });

View File

@ -162,7 +162,7 @@ export default defineIntegration({
), ),
); );
} }
addIntegration(sitemap(options.sitemap)); addIntegration(sitemap(options.Integrations?.sitemap));
} else { } else {
if (verbose) { if (verbose) {
GhostIntegrationLogger.info( GhostIntegrationLogger.info(
@ -181,7 +181,7 @@ export default defineIntegration({
), ),
); );
} }
addIntegration(robotsTxt(options.robotsTxt)); addIntegration(robotsTxt(options.Integrations?.robotsTxt));
} else { } else {
if (verbose) { if (verbose) {
GhostIntegrationLogger.info( GhostIntegrationLogger.info(

View File

@ -41,18 +41,24 @@ export const GhostUserConfigSchema = z.object({
* @default true * @default true
*/ */
fullConsoleLogs: z.boolean().optional().default(false), fullConsoleLogs: z.boolean().optional().default(false),
/** Optional - astro-robots-txt /** OPTIONAL - Integrations Configuration
* This option allows the user to configure the included integration * This option allows the user to configure the included integrations
* Options shown are the availble options * Options shown are the availble options
* @see https://www.npmjs.com/package/astro-robots-txt#configuration
*/ */
robotsTxt: z.custom<RobotsTxtOptions>().optional(), Integrations: z.object({
/** OPTIONAL - astrojs/sitemap /** Optional - astro-robots-txt
* This option allows the user to configure the included integration * This option allows the user to configure the included integration
* Options shown are the availble options * Options shown are the availble options
* @see https://docs.astro.build/en/guides/integrations-guide/sitemap * @see https://www.npmjs.com/package/astro-robots-txt#configuration
*/ */
sitemap: z.custom<SitemapOptions>().optional(), robotsTxt: z.custom<RobotsTxtOptions>().optional(),
/** OPTIONAL - astrojs/sitemap
* This option allows the user to configure the included integration
* Options shown are the availble options
* @see https://docs.astro.build/en/guides/integrations-guide/sitemap
*/
sitemap: z.custom<SitemapOptions>().optional(),
}).optional(),
}); });
/** USER CONFIGURATION SCHEMA */ /** USER CONFIGURATION SCHEMA */