just some code cleanup and organization
This commit is contained in:
parent
915ed14396
commit
7391509587
99
index.ts
99
index.ts
|
@ -6,24 +6,40 @@ import { loadEnv } from 'vite';
|
||||||
import { fromZodError } from "zod-validation-error";
|
import { fromZodError } from "zod-validation-error";
|
||||||
import { viteGhostCMS } from "./src/utils/virtual-imports";
|
import { viteGhostCMS } from "./src/utils/virtual-imports";
|
||||||
|
|
||||||
// LOAD ENVIRONMENT VARIABLES
|
/** INTERNAL CONSTANTS */
|
||||||
const mode = 'all';
|
const IC = {
|
||||||
const prefixes = 'CONTENT_API';
|
/** INTERNAL PACKAGE NAME */
|
||||||
const env = loadEnv(mode, process.cwd(), prefixes);
|
PKG:'@matthiesenxyz/astro-ghostcms',
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
CHECK_ENV:"Checking for Environment Variables...",
|
||||||
|
/** SET ENV GRABBER MODE */
|
||||||
|
MODE: 'all',
|
||||||
|
/** SET ENV GRABBER PREFIXES */
|
||||||
|
PREFIXES: 'CONTENT_API',
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
KEY_MISSING:"CONTENT_API_KEY Missing from .env",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
URL_MISSING:"CONTENT_API_URL Missing from .env",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
IT:"Injecting Theme: ",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
IR:"Injecting Routes...",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
IRD:"Route Injection Disabled - Skipping...",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
IIR:"Injecting Integration Route: ",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
II:"Injecting Integration: ",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
AIbU:"Already Imported by User: ",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
CF:"Checking for ",
|
||||||
|
/** INTERNAL STRING */
|
||||||
|
CONFSETUPDONE:"GhostCMS Injection Complete. Integration is now ready.",
|
||||||
|
}
|
||||||
|
|
||||||
// INTERNAL CONSTANTS
|
/** CONTENT API ENVIRONMENT VARIABLES */
|
||||||
const pkg = '@matthiesenxyz/astro-ghostcms';
|
const ENV = loadEnv(IC.MODE, process.cwd(), IC.PREFIXES);
|
||||||
const CHECK_ENV = "Checking for Environment Variables...";
|
|
||||||
const KEY_MISSING = "CONTENT_API_KEY Missing from .env";
|
|
||||||
const URL_MISSING = "CONTENT_API_URL Missing from .env";
|
|
||||||
const IT = "Injecting Theme: "
|
|
||||||
const IR = "Injecting Routes...";
|
|
||||||
const IRD = "Route Injection Disabled - Skipping...";
|
|
||||||
const IIR = "Injecting Integration Route: "
|
|
||||||
const II = "Injecting Integration: ";
|
|
||||||
const AIbU = "Already Imported by User: ";
|
|
||||||
const CF = "Checking for ";
|
|
||||||
const CONFSETUPDONE = "GhostCMS Injection Complete. Integration is now ready."
|
|
||||||
|
|
||||||
/** Astro-GhostCMS Integration
|
/** Astro-GhostCMS Integration
|
||||||
* @ For more information and to see the docs check
|
* @ For more information and to see the docs check
|
||||||
|
@ -31,7 +47,7 @@ const CONFSETUPDONE = "GhostCMS Injection Complete. Integration is now ready."
|
||||||
*/
|
*/
|
||||||
export default function GhostCMS(options: UserConfig): AstroIntegration {
|
export default function GhostCMS(options: UserConfig): AstroIntegration {
|
||||||
return {
|
return {
|
||||||
name: pkg,
|
name: IC.PKG,
|
||||||
hooks: {
|
hooks: {
|
||||||
'astro:config:setup': async ({
|
'astro:config:setup': async ({
|
||||||
injectRoute,
|
injectRoute,
|
||||||
|
@ -47,36 +63,39 @@ export default function GhostCMS(options: UserConfig): AstroIntegration {
|
||||||
logger.error(`Config Error - ${ validationError }`);
|
logger.error(`Config Error - ${ validationError }`);
|
||||||
throw validationError;
|
throw validationError;
|
||||||
}
|
}
|
||||||
|
/** INTERNAL USERCONFIG ALIAS */
|
||||||
const uconf = o.data;
|
const uconf = o.data;
|
||||||
|
/** CONFIG OPTION: ROUTE INJECTION */
|
||||||
const injection = uconf.disableRouteInjection;
|
const injection = uconf.disableRouteInjection;
|
||||||
|
/** CONFIG OPTION: THEME */
|
||||||
const entry = uconf.theme;
|
const entry = uconf.theme;
|
||||||
|
/** CONFIG OPTION: CONSOLE OUTPUT */
|
||||||
const logs = uconf.disableConsoleOutput;
|
const logs = uconf.disableConsoleOutput;
|
||||||
|
|
||||||
// Check For ENV Variables
|
// Check For ENV Variables
|
||||||
if(!logs) {logger.info(CHECK_ENV)}
|
if(!logs) {logger.info(IC.CHECK_ENV)}
|
||||||
|
|
||||||
// CHECK FOR API KEY
|
// CHECK FOR API KEY
|
||||||
if(env.CONTENT_API_KEY === undefined){
|
if(ENV.CONTENT_API_KEY === undefined){
|
||||||
logger.error(KEY_MISSING);
|
logger.error(IC.KEY_MISSING);
|
||||||
throw KEY_MISSING;
|
throw IC.KEY_MISSING;
|
||||||
}
|
}
|
||||||
// CHECK FOR API URL
|
// CHECK FOR API URL
|
||||||
if(env.CONTENT_API_URL === undefined){
|
if(ENV.CONTENT_API_URL === undefined){
|
||||||
logger.error(URL_MISSING);
|
logger.error(IC.URL_MISSING);
|
||||||
throw URL_MISSING;
|
throw IC.URL_MISSING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!injection){
|
if(!injection){
|
||||||
// THEME SELECTOR
|
// THEME SELECTOR
|
||||||
if (entry === pkg) {
|
if (entry === IC.PKG) {
|
||||||
if(!logs) {logger.info(IT + pkg)}
|
if(!logs) {logger.info(IC.IT + IC.PKG)}
|
||||||
} else {
|
} else {
|
||||||
if(!logs) {logger.info(IT + entry)}
|
if(!logs) {logger.info(IC.IT + entry)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// INJECT ROUTES
|
// INJECT ROUTES
|
||||||
if(!logs) {logger.info(IR)}
|
if(!logs) {logger.info(IC.IR)}
|
||||||
|
|
||||||
injectRoute({
|
injectRoute({
|
||||||
pattern: '/',
|
pattern: '/',
|
||||||
|
@ -118,35 +137,35 @@ export default function GhostCMS(options: UserConfig): AstroIntegration {
|
||||||
entrypoint: `${entry}/archives/[...page].astro`
|
entrypoint: `${entry}/archives/[...page].astro`
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(!logs) {logger.info(IRD)}
|
if(!logs) {logger.info(IC.IRD)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMPORT INTEGRATIONS & INTEGRATION ROUTES
|
// IMPORT INTEGRATIONS & INTEGRATION ROUTES
|
||||||
const int = [...config.integrations];
|
const int = [...config.integrations];
|
||||||
|
|
||||||
// IMPORT INTEGRATION: @ASTROJS/RSS
|
// IMPORT INTEGRATION: @ASTROJS/RSS
|
||||||
if(!logs) {logger.info(IIR + "@astrojs/rss")}
|
if(!logs) {logger.info(IC.IIR + "@astrojs/rss")}
|
||||||
injectRoute({
|
injectRoute({
|
||||||
pattern: '/rss.xml',
|
pattern: '/rss.xml',
|
||||||
entrypoint: `${pkg}/rss.xml.js`
|
entrypoint: `${IC.PKG}/rss.xml.js`
|
||||||
});
|
});
|
||||||
|
|
||||||
// IMPORT INTEGRATION: @ASTROJS/SITEMAP
|
// IMPORT INTEGRATION: @ASTROJS/SITEMAP
|
||||||
if(!logs) {logger.info(CF + "@astrojs/sitemap")}
|
if(!logs) {logger.info(IC.CF + "@astrojs/sitemap")}
|
||||||
if (!int.find(({ name }) => name === '@astrojs/sitemap')) {
|
if (!int.find(({ name }) => name === '@astrojs/sitemap')) {
|
||||||
if(!logs) {logger.info(II + "@astrojs/sitemap")}
|
if(!logs) {logger.info(IC.II + "@astrojs/sitemap")}
|
||||||
int.push(ghostSitemap(uconf));
|
int.push(ghostSitemap(uconf));
|
||||||
} else {
|
} else {
|
||||||
if(!logs) {logger.info(AIbU + "@astrojs/sitemap")}
|
if(!logs) {logger.info(IC.AIbU + "@astrojs/sitemap")}
|
||||||
};
|
};
|
||||||
|
|
||||||
// IMPORT INTEGRATION: ASTRO-ROBOTS-TXT
|
// IMPORT INTEGRATION: ASTRO-ROBOTS-TXT
|
||||||
if(!logs) {logger.info(CF + "astro-robots-txt")}
|
if(!logs) {logger.info(IC.CF + "astro-robots-txt")}
|
||||||
if (!int.find(({ name }) => name === 'astro-robots-txt')) {
|
if (!int.find(({ name }) => name === 'astro-robots-txt')) {
|
||||||
if(!logs) {logger.info(II + "astro-robots-txt")}
|
if(!logs) {logger.info(IC.II + "astro-robots-txt")}
|
||||||
int.push(ghostRobots(uconf));
|
int.push(ghostRobots(uconf));
|
||||||
} else {
|
} else {
|
||||||
if(!logs) {logger.info(AIbU + "astro-robots-txt")}
|
if(!logs) {logger.info(IC.AIbU + "astro-robots-txt")}
|
||||||
};
|
};
|
||||||
try {updateConfig({
|
try {updateConfig({
|
||||||
integrations: [
|
integrations: [
|
||||||
|
@ -161,7 +180,7 @@ export default function GhostCMS(options: UserConfig): AstroIntegration {
|
||||||
|
|
||||||
},
|
},
|
||||||
'astro:config:done': async ({ logger }) => {
|
'astro:config:done': async ({ logger }) => {
|
||||||
logger.info(CONFSETUPDONE);
|
logger.info(IC.CONFSETUPDONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
52
package.json
52
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/astro-ghostcms",
|
"name": "@matthiesenxyz/astro-ghostcms",
|
||||||
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
|
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
|
||||||
"version": "2.1.7",
|
"version": "2.1.8",
|
||||||
"author": "MatthiesenXYZ (https://matthiesen.xyz)",
|
"author": "MatthiesenXYZ (https://matthiesen.xyz)",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -17,15 +17,15 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./index.ts",
|
".": "./index.ts",
|
||||||
"./api": "./src/api/index.ts",
|
"./api": "./src/api/index.ts",
|
||||||
"./index.astro": "./src/routes/index.astro",
|
"./index.astro": "./src/theme/routes/index.astro",
|
||||||
"./404.astro": "./src/routes/404.astro",
|
"./404.astro": "./src/theme/routes/404.astro",
|
||||||
"./[slug].astro": "./src/routes/[slug].astro",
|
"./[slug].astro": "./src/theme/routes/[slug].astro",
|
||||||
"./tags.astro": "./src/routes/tags.astro",
|
"./tags.astro": "./src/theme/routes/tags.astro",
|
||||||
"./authors.astro": "./src/routes/authors.astro",
|
"./authors.astro": "./src/theme/routes/authors.astro",
|
||||||
"./tag/[slug].astro": "./src/routes/tag/[slug].astro",
|
"./tag/[slug].astro": "./src/theme/routes/tag/[slug].astro",
|
||||||
"./author/[slug].astro": "./src/routes/author/[slug].astro",
|
"./author/[slug].astro": "./src/theme/routes/author/[slug].astro",
|
||||||
"./archives/[...page].astro": "./src/routes/archives/[...page].astro",
|
"./archives/[...page].astro": "./src/theme/routes/archives/[...page].astro",
|
||||||
"./rss.xml.js": "./src/routes/rss.xml.js"
|
"./rss.xml.js": "./src/theme/routes/rss.xml.js"
|
||||||
},
|
},
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"types": "src/api/tryghost-content-api.d.ts",
|
"types": "src/api/tryghost-content-api.d.ts",
|
||||||
|
@ -57,25 +57,23 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.3.4",
|
"@astrojs/check": "^0.3.4",
|
||||||
"typescript": "^5.3.3",
|
|
||||||
"zod-validation-error": "^3.0.0",
|
|
||||||
"axios": "^1.0.0",
|
|
||||||
"astro-font": "^0.0.72",
|
|
||||||
"@astrojs/renderer-svelte": "0.5.2",
|
|
||||||
"@astrojs/rss": "^4.0.2",
|
"@astrojs/rss": "^4.0.2",
|
||||||
"@astrojs/sitemap": "^3.0.4",
|
"@astrojs/sitemap": "^3.0.5",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
||||||
|
"@typescript-eslint/parser": "^6.19.0",
|
||||||
|
"astro": "^4.2.1",
|
||||||
|
"astro-font": "^0.0.72",
|
||||||
"astro-robots-txt": "^1.0.0",
|
"astro-robots-txt": "^1.0.0",
|
||||||
"@snowpack/plugin-dotenv": "^2.2.0",
|
"axios": "^1.6.5",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.5.0",
|
"eslint": "^8.56.0",
|
||||||
"@typescript-eslint/parser": "^6.5.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"astro": "^4.1.2",
|
"eslint-plugin-astro": "^0.29.1",
|
||||||
"eslint": "^8.48.0",
|
"prettier": "^3.2.4",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"prettier-plugin-astro": "^0.12.3",
|
||||||
"eslint-plugin-astro": "^0.29.0",
|
"sass": "^1.70.0",
|
||||||
"prettier": "^3.0.3",
|
|
||||||
"prettier-plugin-astro": "^0.12.0",
|
|
||||||
"sass": "^1.66.1",
|
|
||||||
"tiny-invariant": "^1.3.1",
|
"tiny-invariant": "^1.3.1",
|
||||||
"vite": "^4.4.9"
|
"typescript": "^5.3.3",
|
||||||
|
"vite": "^4.5.2",
|
||||||
|
"zod-validation-error": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,57 +25,57 @@ const api = GhostContentAPI({ key, url, version });
|
||||||
// SET Include params
|
// SET Include params
|
||||||
const include:ArrayOrValue<IncludeParam> = ['authors', 'tags'];
|
const include:ArrayOrValue<IncludeParam> = ['authors', 'tags'];
|
||||||
|
|
||||||
// Get Posts (General "ALL")
|
/** Get Posts (General "ALL") */
|
||||||
export const getGhostPosts = async () => {
|
export const getGhostPosts = async () => {
|
||||||
const ghostPosts:PostsOrPages = await api.posts.browse({include,filter:'visibility:public'})
|
const ghostPosts:PostsOrPages = await api.posts.browse({include,filter:'visibility:public'})
|
||||||
return ghostPosts; };
|
return ghostPosts; };
|
||||||
|
|
||||||
// Get Posts (Recent "setLimit?")
|
/** Get Posts (Recent "setLimit?") */
|
||||||
export const getGhostRecentPosts = async (setLimit?:ArrayOrValue<LimitParam>) => {
|
export const getGhostRecentPosts = async (setLimit?:ArrayOrValue<LimitParam>) => {
|
||||||
const ghostRecentPosts:PostsOrPages = await api.posts.browse({limit:setLimit?setLimit:"6",include,filter:'visibility:public'});
|
const ghostRecentPosts:PostsOrPages = await api.posts.browse({limit:setLimit?setLimit:"6",include,filter:'visibility:public'});
|
||||||
return ghostRecentPosts; };
|
return ghostRecentPosts; };
|
||||||
|
|
||||||
// Get Posts (Featured "setLimit?")
|
/** Get Posts (Featured "setLimit?") */
|
||||||
export const getGhostFeaturedPosts = async (setLimit?:ArrayOrValue<LimitParam>) => {
|
export const getGhostFeaturedPosts = async (setLimit?:ArrayOrValue<LimitParam>) => {
|
||||||
const ghostFeaturedPosts:PostsOrPages = await api.posts.browse({limit:setLimit?setLimit:"1",include,filter:'featured:true'});
|
const ghostFeaturedPosts:PostsOrPages = await api.posts.browse({limit:setLimit?setLimit:"1",include,filter:'featured:true'});
|
||||||
return ghostFeaturedPosts; };
|
return ghostFeaturedPosts; };
|
||||||
|
|
||||||
// Get Post (By Slug)
|
/** Get Post (By Slug) */
|
||||||
export const getGhostPostbySlug = async (slug:Nullable<string>) => {
|
export const getGhostPostbySlug = async (slug:Nullable<string>) => {
|
||||||
const ghostPostbySlug:PostOrPage = await api.posts.read({slug},{include});
|
const ghostPostbySlug:PostOrPage = await api.posts.read({slug},{include});
|
||||||
return ghostPostbySlug; };
|
return ghostPostbySlug; };
|
||||||
|
|
||||||
// Get Post (By Tag)
|
/** Get Post (By Tag) */
|
||||||
export const getGhostPostsbyTag = async (slug:Nullable<string>) => {
|
export const getGhostPostsbyTag = async (slug:Nullable<string>) => {
|
||||||
const ghostPostsbyTag:PostsOrPages = await api.posts.browse({filter:`tag:${slug}`,include});
|
const ghostPostsbyTag:PostsOrPages = await api.posts.browse({filter:`tag:${slug}`,include});
|
||||||
return ghostPostsbyTag; };
|
return ghostPostsbyTag; };
|
||||||
|
|
||||||
// Get Tags (General "ALL")
|
/** Get Tags (General "ALL") */
|
||||||
export const getGhostTags = async () => {
|
export const getGhostTags = async () => {
|
||||||
const ghostTags:Tags = await api.tags.browse({include:`count.posts`});
|
const ghostTags:Tags = await api.tags.browse({include:`count.posts`});
|
||||||
return ghostTags; };
|
return ghostTags; };
|
||||||
|
|
||||||
// Get Tag (By Slug)
|
/** Get Tag (By Slug) */
|
||||||
export const getGhostTagbySlug = async (slug:Nullable<string>) => {
|
export const getGhostTagbySlug = async (slug:Nullable<string>) => {
|
||||||
const ghostTagbySlug:Tag = await api.tags.read({slug},{include:`count.posts`});
|
const ghostTagbySlug:Tag = await api.tags.read({slug},{include:`count.posts`});
|
||||||
return ghostTagbySlug; };
|
return ghostTagbySlug; };
|
||||||
|
|
||||||
// Get Authors (General "ALL")
|
/** Get Authors (General "ALL") */
|
||||||
export const getGhostAuthors = async () => {
|
export const getGhostAuthors = async () => {
|
||||||
const ghostAuthors:Authors = await api.authors.browse({include:`count.posts`});
|
const ghostAuthors:Authors = await api.authors.browse({include:`count.posts`});
|
||||||
return ghostAuthors; };
|
return ghostAuthors; };
|
||||||
|
|
||||||
// Get Pages (ALL)
|
/** Get Pages (ALL) */
|
||||||
export const getGhostPages = async () => {
|
export const getGhostPages = async () => {
|
||||||
const ghostPages:PostsOrPages = await api.pages.browse();
|
const ghostPages:PostsOrPages = await api.pages.browse();
|
||||||
return ghostPages; };
|
return ghostPages; };
|
||||||
|
|
||||||
// Get Page (by Slug)
|
/** Get Page (by Slug) */
|
||||||
export const getGhostPage = async (slug:Nullable<string>) => {
|
export const getGhostPage = async (slug:Nullable<string>) => {
|
||||||
const ghostPage:PostOrPage = await api.pages.read({slug});
|
const ghostPage:PostOrPage = await api.pages.read({slug});
|
||||||
return ghostPage; };
|
return ghostPage; };
|
||||||
|
|
||||||
// Get Settings
|
/** Get Settings */
|
||||||
export const getGhostSettings = async () => {
|
export const getGhostSettings = async () => {
|
||||||
const ghostSettings:Settings = await api.settings.browse();
|
const ghostSettings:Settings = await api.settings.browse();
|
||||||
return ghostSettings; };
|
return ghostSettings; };
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import { getGhostImgPath } from "../utils";
|
import { getGhostImgPath } from "../utils";
|
||||||
import type { Settings, Author } from "../api";
|
import type { Settings, Author } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
author: Author;
|
author: Author;
|
||||||
wide?: boolean;
|
wide?: boolean;
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import { getGhostImgPath } from "../utils";
|
import { getGhostImgPath } from "../utils";
|
||||||
import type { Settings, PostOrPage } from "../api";
|
import type { Settings, PostOrPage } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: PostOrPage;
|
post: PostOrPage;
|
||||||
settings: Settings;
|
settings: Settings;
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import { getGhostImgPath } from "../utils";
|
import { getGhostImgPath } from "../utils";
|
||||||
import type { Settings } from "../api";
|
import type { Settings } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
image: string;
|
image: string;
|
||||||
alt?: string;
|
alt?: string;
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import type { Settings } from "../api";
|
import type { Settings } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
};
|
};
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import type { Settings } from "../api";
|
import type { Settings } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import { getGhostImgPath } from "../utils";
|
import { getGhostImgPath } from "../utils";
|
||||||
import type { Settings } from "../api";
|
import type { Settings } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
featureImg?: string;
|
featureImg?: string;
|
||||||
mainTitle?: string;
|
mainTitle?: string;
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
import Header from "./Header.astro";
|
import Header from "./Header.astro";
|
||||||
import Footer from "./Footer.astro";
|
import Footer from "./Footer.astro";
|
||||||
import type { Settings } from "../api";
|
import type { Settings } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import FeatureImage from "./FeatureImage.astro";
|
import FeatureImage from "./FeatureImage.astro";
|
||||||
import type { Settings, PostOrPage } from "../api";
|
import type { Settings, PostOrPage } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
page: PostOrPage;
|
page: PostOrPage;
|
||||||
settings: Settings;
|
settings: Settings;
|
|
@ -2,7 +2,7 @@
|
||||||
import PostHero from "./PostHero.astro";
|
import PostHero from "./PostHero.astro";
|
||||||
import PostFooter from "./PostFooter.astro";
|
import PostFooter from "./PostFooter.astro";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
import type {PostOrPage, PostsOrPages, Settings } from "../api";
|
import type {PostOrPage, PostsOrPages, Settings } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: PostOrPage;
|
post: PostOrPage;
|
||||||
settings: Settings;
|
settings: Settings;
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import PostPreview from "./PostPreview.astro";
|
import PostPreview from "./PostPreview.astro";
|
||||||
import type { Settings, PostOrPage, PostsOrPages } from "../api";
|
import type { Settings, PostOrPage, PostsOrPages } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: PostOrPage;
|
post: PostOrPage;
|
||||||
settings: Settings;
|
settings: Settings;
|
|
@ -2,7 +2,7 @@
|
||||||
import FeatureImage from "./FeatureImage.astro";
|
import FeatureImage from "./FeatureImage.astro";
|
||||||
import AuthorList from "./AuthorList.astro";
|
import AuthorList from "./AuthorList.astro";
|
||||||
import { formatDate } from "../utils";
|
import { formatDate } from "../utils";
|
||||||
import type { Settings, PostOrPage } from "../api";
|
import type { Settings, PostOrPage } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: PostOrPage;
|
post: PostOrPage;
|
||||||
settings: Settings;
|
settings: Settings;
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
import { getGhostImgPath, formatDate } from "../utils";
|
import { getGhostImgPath, formatDate } from "../utils";
|
||||||
import AuthorList from "./AuthorList.astro";
|
import AuthorList from "./AuthorList.astro";
|
||||||
import type { Settings, PostOrPage, Tag } from "../api";
|
import type { Settings, PostOrPage, Tag } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: PostOrPage;
|
post: PostOrPage;
|
||||||
settings: Settings;
|
settings: Settings;
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import PostPreview from "./PostPreview.astro";
|
import PostPreview from "./PostPreview.astro";
|
||||||
import type { Settings, PostOrPage } from "../api";
|
import type { Settings, PostOrPage } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
posts: PostOrPage[];
|
posts: PostOrPage[];
|
||||||
settings: Settings;
|
settings: Settings;
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import { getGhostImgPath } from "../utils";
|
import { getGhostImgPath } from "../utils";
|
||||||
import type { Settings, Tag } from "../api";
|
import type { Settings, Tag } from "../../api";
|
||||||
export type Props = {
|
export type Props = {
|
||||||
tag: Tag;
|
tag: Tag;
|
||||||
addClass?: string;
|
addClass?: string;
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import type { Settings } from "../api";
|
import type { Settings } from "../../api";
|
||||||
import { AstroFont } from "astro-font";
|
import { AstroFont } from "astro-font";
|
||||||
import ViewTransitions from "astro/components/ViewTransitions.astro";
|
import ViewTransitions from "astro/components/ViewTransitions.astro";
|
||||||
import MainLayout from "../components/MainLayout.astro";
|
import MainLayout from "../components/MainLayout.astro";
|
|
@ -3,7 +3,7 @@ import type { InferGetStaticPropsType } from 'astro';
|
||||||
import DefaultPageLayout from "../layouts/default.astro";
|
import DefaultPageLayout from "../layouts/default.astro";
|
||||||
import Page from "../components/Page.astro";
|
import Page from "../components/Page.astro";
|
||||||
import Post from "../components/Post.astro";
|
import Post from "../components/Post.astro";
|
||||||
import { getGhostSettings, getGhostPages, getGhostPosts } from "../api";
|
import { getGhostSettings, getGhostPages, getGhostPosts } from "../../api";
|
||||||
import invariant from 'tiny-invariant';
|
import invariant from 'tiny-invariant';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
|
@ -5,8 +5,7 @@ import DefaultPageLayout from "../../layouts/default.astro";
|
||||||
import PostPreviewList from "../../components/PostPreviewList.astro";
|
import PostPreviewList from "../../components/PostPreviewList.astro";
|
||||||
import HeroContent from "../../components/HeroContent.astro";
|
import HeroContent from "../../components/HeroContent.astro";
|
||||||
import Paginator from "../../components/Paginator.astro";
|
import Paginator from "../../components/Paginator.astro";
|
||||||
import { getGhostSettings, getGhostPosts } from "../../api";
|
import { getGhostSettings, getGhostPosts, type PostOrPage } from "../../../api";
|
||||||
import type { PostOrPage } from '../../api';
|
|
||||||
|
|
||||||
export async function getStaticPaths({ paginate }:GetStaticPathsOptions) {
|
export async function getStaticPaths({ paginate }:GetStaticPathsOptions) {
|
||||||
const posts = await getGhostPosts();
|
const posts = await getGhostPosts();
|
|
@ -2,7 +2,7 @@
|
||||||
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
||||||
import DefaultPageLayout from "../../layouts/default.astro";
|
import DefaultPageLayout from "../../layouts/default.astro";
|
||||||
import PostPreviewList from "../../components/PostPreviewList.astro";
|
import PostPreviewList from "../../components/PostPreviewList.astro";
|
||||||
import { getGhostPosts, getGhostAuthors, getGhostSettings } from "../../api";
|
import { getGhostPosts, getGhostAuthors, getGhostSettings } from "../../../api";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
import DefaultPageLayout from "../layouts/default.astro";
|
import DefaultPageLayout from "../layouts/default.astro";
|
||||||
import AuthorCard from "../components/AuthorCard.astro";
|
import AuthorCard from "../components/AuthorCard.astro";
|
||||||
import { getGhostAuthors, getGhostSettings } from "../api";
|
import { getGhostAuthors, getGhostSettings } from "../../api";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
||||||
let title = "All Authors";
|
let title = "All Authors";
|
|
@ -2,7 +2,7 @@
|
||||||
import DefaultPageLayout from "../layouts/default.astro";
|
import DefaultPageLayout from "../layouts/default.astro";
|
||||||
import PostPreviewList from "../components/PostPreviewList.astro";
|
import PostPreviewList from "../components/PostPreviewList.astro";
|
||||||
import HeroContent from "../components/HeroContent.astro";
|
import HeroContent from "../components/HeroContent.astro";
|
||||||
import { getGhostPosts, getGhostSettings } from "../api";
|
import { getGhostPosts, getGhostSettings } from "../../api";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
const posts = await getGhostPosts();
|
const posts = await getGhostPosts();
|
||||||
const settings = await getGhostSettings();
|
const settings = await getGhostSettings();
|
|
@ -1,5 +1,5 @@
|
||||||
import rss from "@astrojs/rss";
|
import rss from "@astrojs/rss";
|
||||||
import { getGhostPosts, getGhostSettings } from '../api';
|
import { getGhostPosts, getGhostSettings } from '../../api';
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
||||||
export async function GET(context) {
|
export async function GET(context) {
|
|
@ -2,7 +2,7 @@
|
||||||
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
||||||
import DefaultPageLayout from "../../layouts/default.astro";
|
import DefaultPageLayout from "../../layouts/default.astro";
|
||||||
import PostPreview from "../../components/PostPreview.astro";
|
import PostPreview from "../../components/PostPreview.astro";
|
||||||
import { getGhostPosts, getGhostTags, getGhostSettings } from "../../api";
|
import { getGhostPosts, getGhostTags, getGhostSettings } from "../../../api";
|
||||||
import { getGhostImgPath } from "../../utils";
|
import { getGhostImgPath } from "../../utils";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
import DefaultPageLayout from "../layouts/default.astro";
|
import DefaultPageLayout from "../layouts/default.astro";
|
||||||
import TagCard from "../components/TagCard.astro";
|
import TagCard from "../components/TagCard.astro";
|
||||||
import { getGhostSettings, getGhostTags } from "../api";
|
import { getGhostSettings, getGhostTags } from "../../api";
|
||||||
import invariant from 'tiny-invariant';
|
import invariant from 'tiny-invariant';
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,5 @@ export const UserConfigSchema = z.object({
|
||||||
robotstxt: S.RobotsTxtSchema.optional(),
|
robotstxt: S.RobotsTxtSchema.optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** USER CONFIGURATION SCHEMA */
|
||||||
export type UserConfig = z.infer<typeof UserConfigSchema>
|
export type UserConfig = z.infer<typeof UserConfigSchema>
|
Loading…
Reference in New Issue