This commit is contained in:
Adam Matthiesen 2024-01-20 14:12:24 -08:00
parent 75416edef2
commit 79f269fc00
4 changed files with 50 additions and 8 deletions

View File

@ -14,6 +14,10 @@ const env = loadEnv(mode, process.cwd(), prefixes);
// SET LOCAL PACKAGE NAME
const pkg = '@matthiesenxyz/astro-ghostcms';
/** Astro-GhostCMS Integration
* @ For more information and to see the docs check
* @ https://astro-ghostcms.xyz
*/
export default function GhostCMS(options: UserConfig): AstroIntegration {
return {
name: pkg,

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms",
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
"version": "2.1.2",
"version": "2.1.3",
"author": "MatthiesenXYZ (https://matthiesen.xyz)",
"type": "module",
"license": "MIT",

View File

@ -2,8 +2,20 @@ import { z } from 'astro/zod';
import * as S from './schemas';
export const UserConfigSchema = z.object({
/** OPTIONAL - Theme Selector
* @ This option allows the user to replace the included theme with an external npm module */
theme: z.string().default('@matthiesenxyz/astro-ghostcms'),
/** 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: S.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: S.RobotsTxtSchema.optional(),
});

View File

@ -1,21 +1,47 @@
import { z } from 'astro/zod';
import { boolean, string, z } from 'astro/zod';
export const SitemapSchema = z.object({
/** EXAMPLE: ['https://example-1.com', 'https://example-2.com]
* @REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#custompages
*/
customPages: z.string().array().optional(),
/** EXAMPLE: 10000
* @REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#entrylimit
*/
entryLimit: z.number().optional()
})
const RobotsPolicySchema = z.object({
/** You must provide a name of the automatic client (search engine crawler).
* @ Wildcards are allowed.
*/
userAgent: z.string(),
allow: z.string().optional(),
disallow: z.string().optional(),
cleanParam: z.string().optional(),
crawlDelay: z.number()
/** Allowed paths for crawling */
allow: z.string().or(string().array()).optional(),
/** Disallowed paths for crawling */
disallow: z.string().or(string().array()).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().or(string().array()).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({
host: z.string().optional(),
sitemap: z.string().optional(),
/** @EXAMPLE1 host: true - automatically resolve using the site option from Astro config
* @EXAMPLE2 host: 'example.com'
*/
host: z.string().or(boolean()).optional(),
/** @EXAMPLE1 sitemap: "https://example.com/sitemap-0.xml"
* @EXAMPLE2 sitemap: ['https://example.com/sitemap-0.xml','https://example.com/sitemap-1.xml']
* @EXAMPLE3 sitemap: false - If you want to get the robots.txt file without the Sitemap: ... entry, set the sitemap parameter to false.
*/
sitemap: z.string().or(boolean()).or(string().array()).optional(),
/** astrojs/sitemap and astro-sitemap 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(),
})