Woo Better config options!
This commit is contained in:
parent
657cfe7568
commit
017e641afd
|
@ -63,14 +63,22 @@ export default defineConfig({
|
||||||
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
|
||||||
disableThemeProvider: false; // OPTIONAL - Default False
|
|
||||||
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
|
||||||
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: {
|
||||||
|
// OPTIONAL
|
||||||
|
// ADVANCED USAGE - https://www.npmjs.com/package/astro-robots-txt#configuration
|
||||||
|
}
|
||||||
|
sitemap: {
|
||||||
|
// OPTIONAL
|
||||||
|
// ADVANCED USAGE - https://docs.astro.build/en/guides/integrations-guide/sitemap
|
||||||
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -120,7 +120,7 @@ export default defineIntegration({
|
||||||
);
|
);
|
||||||
|
|
||||||
// Theme Provider
|
// Theme Provider
|
||||||
if (!options.disableThemeProvider) {
|
if (!options.ThemeProvider?.disableThemeProvider) {
|
||||||
addIntegration(
|
addIntegration(
|
||||||
ghostThemeProvider({
|
ghostThemeProvider({
|
||||||
theme: options.ThemeProvider?.theme,
|
theme: options.ThemeProvider?.theme,
|
||||||
|
@ -162,7 +162,7 @@ export default defineIntegration({
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
addIntegration(sitemap());
|
addIntegration(sitemap(options.sitemap));
|
||||||
} else {
|
} else {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
GhostIntegrationLogger.info(
|
GhostIntegrationLogger.info(
|
||||||
|
@ -173,7 +173,7 @@ export default defineIntegration({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ASTRO-ROBOTS-TXT
|
// ASTRO-ROBOTS-TXT
|
||||||
if (!hasIntegration("@astro-robots-txt")) {
|
if (!hasIntegration("astro-robots-txt")) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
GhostIntegrationLogger.info(
|
GhostIntegrationLogger.info(
|
||||||
c.bold(
|
c.bold(
|
||||||
|
@ -181,7 +181,7 @@ export default defineIntegration({
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
addIntegration(robotsTxt());
|
addIntegration(robotsTxt(options.robotsTxt));
|
||||||
} else {
|
} else {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
GhostIntegrationLogger.info(
|
GhostIntegrationLogger.info(
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
import { z } from "astro/zod";
|
|
||||||
|
|
||||||
const RobotsPolicySchema = z.object({
|
|
||||||
/** You must provide a name of the automatic client (search engine crawler).
|
|
||||||
* Wildcards are allowed.
|
|
||||||
*/
|
|
||||||
userAgent: z.string(),
|
|
||||||
/** Allowed paths for crawling */
|
|
||||||
allow: z.string().optional(),
|
|
||||||
/** Disallowed paths for crawling */
|
|
||||||
disallow: z.string().optional(),
|
|
||||||
/** Indicates that the page's URL contains parameters that should be ignored during crawling.
|
|
||||||
* Maximum string length is limited to 500.
|
|
||||||
*/
|
|
||||||
cleanParam: z.string().optional(),
|
|
||||||
/** Minimum interval (in secs) for the crawler to wait after loading one page, before starting other */
|
|
||||||
crawlDelay: z.number().optional(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const RobotsTxtSchema = z.object({
|
|
||||||
/** @example host: true
|
|
||||||
* // Automatically resolve using the site option from Astro config
|
|
||||||
* @example host: 'example.com'
|
|
||||||
*/
|
|
||||||
host: z.string().optional(),
|
|
||||||
/** @example sitemap: "https://example.com/sitemap-0.xml"
|
|
||||||
* @example sitemap: ['https://example.com/sitemap-0.xml','https://example.com/sitemap-1.xml']
|
|
||||||
* @example sitemap: false - If you want to get the robots.txt file without the Sitemap: ... entry, set the sitemap parameter to false.
|
|
||||||
*/
|
|
||||||
sitemap: z.union([z.string(), z.string().array(), z.boolean()]).optional(),
|
|
||||||
/** astrojs/sitemap and astro-robots-txt integrations have the sitemap-index.xml as their primary output. That is why the default value of sitemapBaseFileName is set to sitemap-index.
|
|
||||||
* @example sitemapBaseFileName: 'custom-sitemap'
|
|
||||||
*/
|
|
||||||
sitemapBaseFileName: z.string().optional(),
|
|
||||||
/** SET POLICY RULES */
|
|
||||||
policy: RobotsPolicySchema.array().optional(),
|
|
||||||
});
|
|
|
@ -1,38 +0,0 @@
|
||||||
import { z } from "astro/zod";
|
|
||||||
|
|
||||||
const localeKeySchema = z.string().min(1);
|
|
||||||
enum EnumChangefreq {
|
|
||||||
DAILY = "daily",
|
|
||||||
MONTHLY = "monthly",
|
|
||||||
ALWAYS = "always",
|
|
||||||
HOURLY = "hourly",
|
|
||||||
WEEKLY = "weekly",
|
|
||||||
YEARLY = "yearly",
|
|
||||||
NEVER = "never",
|
|
||||||
}
|
|
||||||
export const SitemapSchema = z.object({
|
|
||||||
filter: z.function().args(z.string()).returns(z.boolean()).optional(),
|
|
||||||
customPages: z.string().url().array().optional(),
|
|
||||||
i18n: z
|
|
||||||
.object({
|
|
||||||
defaultLocale: localeKeySchema,
|
|
||||||
locales: z.record(
|
|
||||||
localeKeySchema,
|
|
||||||
z
|
|
||||||
.string()
|
|
||||||
.min(2)
|
|
||||||
.regex(/^[a-zA-Z\-]+$/gm, {
|
|
||||||
message: "Only English alphabet symbols and hyphen allowed",
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
})
|
|
||||||
.refine((val) => !val || val.locales[val.defaultLocale], {
|
|
||||||
message: "`defaultLocale` must exist in `locales` keys",
|
|
||||||
})
|
|
||||||
.optional(),
|
|
||||||
entryLimit: z.number().nonnegative().optional(),
|
|
||||||
serialize: z.function().args(z.any()).returns(z.any()).optional(),
|
|
||||||
changefreq: z.nativeEnum(EnumChangefreq).optional(),
|
|
||||||
lastmod: z.date().optional(),
|
|
||||||
priority: z.number().min(0).max(1).optional(),
|
|
||||||
});
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { z } from "astro/zod";
|
import { z } from "astro/zod";
|
||||||
import { RobotsTxtSchema } from "./robots.ts";
|
import type { RobotsTxtOptions } from "astro-robots-txt";
|
||||||
import { SitemapSchema } from "./sitemap.ts";
|
import type { SitemapOptions } from "@astrojs/sitemap";
|
||||||
|
|
||||||
export const GhostUserConfigSchema = z.object({
|
export const GhostUserConfigSchema = z.object({
|
||||||
/** OPTIONAL - Either set the URL in your .env or put it here
|
/** OPTIONAL - Either set the URL in your .env or put it here
|
||||||
|
@ -14,12 +14,12 @@ export const GhostUserConfigSchema = z.object({
|
||||||
* ],
|
* ],
|
||||||
* }); */
|
* }); */
|
||||||
ghostURL: z.string().url().optional(),
|
ghostURL: z.string().url().optional(),
|
||||||
|
ThemeProvider: z
|
||||||
|
.object({
|
||||||
/** OPTIONAL - Disable the theme provider
|
/** OPTIONAL - Disable the theme provider
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
disableThemeProvider: z.boolean().optional().default(false),
|
disableThemeProvider: z.boolean().optional().default(false),
|
||||||
ThemeProvider: z
|
|
||||||
.object({
|
|
||||||
/** OPTIONAL - Set the theme you want to use
|
/** OPTIONAL - Set the theme you want to use
|
||||||
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
|
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
|
||||||
*/
|
*/
|
||||||
|
@ -37,22 +37,22 @@ export const GhostUserConfigSchema = z.object({
|
||||||
* @default true
|
* @default true
|
||||||
*/
|
*/
|
||||||
enableOGImages: z.boolean().optional().default(true),
|
enableOGImages: z.boolean().optional().default(true),
|
||||||
/** OPTIONAL - astrojs/sitemap
|
|
||||||
* This option allows the user to configure the included integration
|
|
||||||
* Options shown are the availble options
|
|
||||||
* REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap
|
|
||||||
*/
|
|
||||||
sitemap: SitemapSchema.optional(),
|
|
||||||
/** OPTIONAL - astro-robots-txt
|
|
||||||
* This option allows the user to configure the included integration
|
|
||||||
* Options shown are the availble options
|
|
||||||
* REFERENCE https://www.npmjs.com/package/astro-robots-txt#configuration
|
|
||||||
*/
|
|
||||||
robotstxt: RobotsTxtSchema.optional(),
|
|
||||||
/** Allows the user to turn on/off Full Console Logs
|
/** Allows the user to turn on/off Full Console Logs
|
||||||
* @default true
|
* @default true
|
||||||
*/
|
*/
|
||||||
fullConsoleLogs: z.boolean().optional().default(false),
|
fullConsoleLogs: z.boolean().optional().default(false),
|
||||||
|
/** Optional - astro-robots-txt
|
||||||
|
* This option allows the user to configure the included integration
|
||||||
|
* Options shown are the availble options
|
||||||
|
* @see https://www.npmjs.com/package/astro-robots-txt#configuration
|
||||||
|
*/
|
||||||
|
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(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** USER CONFIGURATION SCHEMA */
|
/** USER CONFIGURATION SCHEMA */
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default defineConfig({
|
||||||
ThemeProvider: {
|
ThemeProvider: {
|
||||||
theme: "@matthiesenxyz/astro-ghostcms-brutalbyelian",
|
theme: "@matthiesenxyz/astro-ghostcms-brutalbyelian",
|
||||||
},
|
},
|
||||||
|
fullConsoleLogs: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue