up versions
This commit is contained in:
parent
a917c63dbe
commit
e2fb3c9ad4
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/astro-ghostcms-theme-default",
|
"name": "@matthiesenxyz/astro-ghostcms-theme-default",
|
||||||
"description": "Default Theme for astro-ghostcms",
|
"description": "Default Theme for astro-ghostcms",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
"astro": "^4.2.1"
|
"astro": "^4.2.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@matthiesenxyz/astro-ghostcms": "^3.1.0",
|
"@matthiesenxyz/astro-ghostcms": "^3.1.1",
|
||||||
"tiny-invariant": "^1.3.1",
|
"tiny-invariant": "^1.3.1",
|
||||||
"astro-font": "^0.0.77"
|
"astro-font": "^0.0.77"
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ const { post, settings } = Astro.props as Props;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin: 0 0 0 4px;
|
margin: 0 0 0 4px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
padding-inline-end: 1rem;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ const { image, alt, caption = "", settings, transitionName } = Astro.props as Pr
|
||||||
alt={alt}
|
alt={alt}
|
||||||
transition:name={transitionName}
|
transition:name={transitionName}
|
||||||
/>
|
/>
|
||||||
{caption && <figcaption>{caption}</figcaption>}
|
{caption && <figcaption><Fragment set:html={caption}></figcaption>}
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -19,8 +19,10 @@ const { content, permalink, image, settings, bodyClass = "" } = Astro.props as P
|
||||||
const ghostAccentColor = settings.accent_color;
|
const ghostAccentColor = settings.accent_color;
|
||||||
---
|
---
|
||||||
|
|
||||||
<html lang="en" data-color-scheme="light">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<Fragment set:html={settings.codeinjection_head}>
|
||||||
|
|
||||||
<AstroFont
|
<AstroFont
|
||||||
config={[
|
config={[
|
||||||
{
|
{
|
||||||
|
@ -34,7 +36,6 @@ const ghostAccentColor = settings.accent_color;
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
padding-right: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +213,7 @@ html.dark-mode .post-card-title {
|
||||||
}
|
}
|
||||||
|
|
||||||
html.dark-mode .post-card-excerpt {
|
html.dark-mode .post-card-excerpt {
|
||||||
color: color-mod(var(--color-midgrey) l(+10%));
|
color: var(--color-midgrey);
|
||||||
}
|
}
|
||||||
|
|
||||||
html.dark-mode .post-full-content {
|
html.dark-mode .post-full-content {
|
||||||
|
@ -388,3 +389,7 @@ html.dark-mode .subscribe-form .error .message-error {
|
||||||
html.dark-mode .subscribe-form .success .message-success {
|
html.dark-mode .subscribe-form .success .message-success {
|
||||||
color: color-mod(var(--color-green) l(+5%) s(-5%));
|
color: color-mod(var(--color-green) l(+5%) s(-5%));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html.dark-mode figcaption {
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
|
@ -27,7 +27,7 @@ const IC = {
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
IDR:"Injecting Default Routes...",
|
IDR:"Injecting Default Routes...",
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
IR:"Injecting Default Theme Routes...",
|
ITR:"Injecting Default Theme Routes...",
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
IRD:"Route Injection Disabled - Skipping...",
|
IRD:"Route Injection Disabled - Skipping...",
|
||||||
/** INTERNAL STRING */
|
/** INTERNAL STRING */
|
||||||
|
@ -111,10 +111,10 @@ export default function GhostCMS(options: UserConfig): AstroIntegration {
|
||||||
if( !logs ) { logger.info( IC.IDR )}
|
if( !logs ) { logger.info( IC.IDR )}
|
||||||
|
|
||||||
if( !logs ) { logger.info( IC.F0FR )}
|
if( !logs ) { logger.info( IC.F0FR )}
|
||||||
injectRoute({ pattern: '/404', entrypoint: IC.PKG+'/404.astro' });
|
injectRoute({ pattern: '/404', entrypoint: `${IC.PKG}/404.astro` });
|
||||||
|
|
||||||
if( !logs ) { logger.info( IC.RSS )}
|
if( !logs ) { logger.info( IC.RSS )}
|
||||||
injectRoute({ pattern: '/rss.xml', entrypoint: IC.PKG+'/rss.xml.ts' });
|
injectRoute({ pattern: '/rss.xml', entrypoint: `${IC.PKG}/rss.xml.ts` });
|
||||||
|
|
||||||
// THEME ROUTES
|
// THEME ROUTES
|
||||||
if( !logs ) { logger.info( IC.ITR )}
|
if( !logs ) { logger.info( IC.ITR )}
|
||||||
|
@ -139,20 +139,20 @@ export default function GhostCMS(options: UserConfig): AstroIntegration {
|
||||||
const int = [...config.integrations];
|
const int = [...config.integrations];
|
||||||
|
|
||||||
// IMPORT INTEGRATION: @ASTROJS/SITEMAP
|
// IMPORT INTEGRATION: @ASTROJS/SITEMAP
|
||||||
if( !logs ) { logger.info( IC.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( IC.II + "@astrojs/sitemap" )}
|
if( !logs ) { logger.info( `${IC.II}@astrojs/sitemap` )}
|
||||||
int.push( ghostSitemap( uconf ));
|
int.push( ghostSitemap( uconf ));
|
||||||
} else { if( !logs ) { logger.info( IC.AIbU + "@astrojs/sitemap" )}
|
} else { if( !logs ) { logger.info( `${IC.AIbU}@astrojs/sitemap` )}
|
||||||
};
|
};
|
||||||
|
|
||||||
// IMPORT INTEGRATION: ASTRO-ROBOTS-TXT
|
// IMPORT INTEGRATION: ASTRO-ROBOTS-TXT
|
||||||
if( !logs ) { logger.info( IC.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( IC.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( IC.AIbU + "astro-robots-txt" )}
|
if( !logs ) { logger.info( `${IC.AIbU}astro-robots-txt` )}
|
||||||
};
|
};
|
||||||
|
|
||||||
// FINAL STEP TO KEEP INTEGRATION LIVE
|
// FINAL STEP TO KEEP INTEGRATION LIVE
|
||||||
|
|
|
@ -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": "3.1.0",
|
"version": "3.1.1",
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
"vitest-fetch-mock": "^0.2.2"
|
"vitest-fetch-mock": "^0.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.0",
|
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.1",
|
||||||
"@astrojs/rss": "^4.0.2",
|
"@astrojs/rss": "^4.0.2",
|
||||||
"@astrojs/sitemap": "^3.0.5",
|
"@astrojs/sitemap": "^3.0.5",
|
||||||
"@ts-ghost/core-api": "^5.1.2",
|
"@ts-ghost/core-api": "^5.1.2",
|
||||||
|
|
|
@ -2,22 +2,22 @@ import rss from "@astrojs/rss";
|
||||||
import { getAllPosts, getSettings } from '../api';
|
import { getAllPosts, getSettings } from '../api';
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
||||||
export async function GET(context) {
|
export async function GET(context: { site: string; }) {
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
invariant(settings, "Settings not found");
|
invariant(settings, "Settings not found");
|
||||||
const allPosts = [...posts];
|
|
||||||
const title = settings.title;
|
const title = settings.title;
|
||||||
const description = settings.description;
|
const description = settings.description;
|
||||||
return rss({
|
return rss({
|
||||||
title: title,
|
title: title,
|
||||||
description: description,
|
description: description,
|
||||||
site: context.site,
|
site: context.site,
|
||||||
items: allPosts.map((post) => ({
|
items: posts.map((post) => ({
|
||||||
title: post.title,
|
title: post.title,
|
||||||
pubDate: post.published_at,
|
pubDate: new Date(post.published_at?post.published_at:post.created_at),
|
||||||
description: post.excerpt,
|
description: post.excerpt,
|
||||||
link: `/${post.slug}/`,
|
link: `/${post.slug}/`,
|
||||||
})),
|
author: post.primary_author?.name,
|
||||||
|
} ) ),
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ import fs from 'node:fs';
|
||||||
import { ExpressiveCodeTheme } from '@astrojs/starlight/expressive-code';
|
import { ExpressiveCodeTheme } from '@astrojs/starlight/expressive-code';
|
||||||
import starlight from "@astrojs/starlight";
|
import starlight from "@astrojs/starlight";
|
||||||
|
|
||||||
const houstonFile = `./houston-vscode.jsonc`;
|
const houstonFile = './houston-vscode.jsonc';
|
||||||
const houston = fs.readFileSync(
|
const houston = fs.readFileSync(
|
||||||
new URL(houstonFile, import.meta.url),'utf-8');
|
new URL(houstonFile, import.meta.url),'utf-8');
|
||||||
const houstonTheme = ExpressiveCodeTheme.fromJSONString(houston);
|
const houstonTheme = ExpressiveCodeTheme.fromJSONString(houston);
|
||||||
|
@ -35,7 +35,7 @@ export default defineConfig({
|
||||||
{ label: 'API ( DIY ) Mode', items: [
|
{ label: 'API ( DIY ) Mode', items: [
|
||||||
{ label: 'Install', link: '/docs/introduction/api/install' },
|
{ label: 'Install', link: '/docs/introduction/api/install' },
|
||||||
{ label: 'Basic API Usage', link: '/docs/introduction/api/usage' }, ], }, ], },
|
{ label: 'Basic API Usage', link: '/docs/introduction/api/usage' }, ], }, ], },
|
||||||
//{ label: 'Advanced Usage', link: '/docs/#' },
|
{ label: 'Default Theme Usage', autogenerate: { directory: 'docs/theme-default'}, },
|
||||||
{ label: 'Tutorials', autogenerate: { directory: 'docs/tutorials' }, },
|
{ label: 'Tutorials', autogenerate: { directory: 'docs/tutorials' }, },
|
||||||
{ label: 'Reference', autogenerate: { directory: 'docs/reference' }, },
|
{ label: 'Reference', autogenerate: { directory: 'docs/reference' }, },
|
||||||
],
|
],
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
title: Enable Darkmode
|
||||||
|
description: How to enable Dark-Mode on the default theme
|
||||||
|
---
|
||||||
|
|
||||||
|
*Requires `@matthiesenxyz/astro-ghostcms` version 0.1.1 and above*
|
||||||
|
|
||||||
|
To enable darkmode on your Astro-Ghost install for the basic theme all you have to do is add a Code_Injection to the Site Header. Dont know how to do that? No Problem! Just look below
|
||||||
|
|
||||||
|
- To get started Login to your GhostCMS Admin Dashboard.
|
||||||
|
- Click the Settings Icon on the bottom left next to your Avatar.
|
||||||
|
- Scroll down to `Avanced` > `Code injection` and click Open
|
||||||
|
- In the Site header tab paste the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
<script>document.documentElement.classList.add('dark-mode');</script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('astro:after-swap', () => {
|
||||||
|
document.documentElement.classList.add('dark-mode');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
The Above script will enable darkmode, and make it persist with Astro View Transitions.
|
Loading…
Reference in New Issue