Add new Starlight-GhostCMS plugin #66
|
@ -1,5 +1,4 @@
|
|||
---
|
||||
|
||||
import type { Post } from '../schemas/posts'
|
||||
import Author from './Author.astro'
|
||||
|
||||
|
@ -10,12 +9,25 @@ interface Props {
|
|||
const { entry } = Astro.props
|
||||
const { authors, published_at, created_at } = entry
|
||||
|
||||
const dateC = new Date(published_at?published_at:created_at)
|
||||
const dateISO = dateC.toISOString()
|
||||
const dateLocal = dateC
|
||||
.toLocaleDateString(
|
||||
"en-US", {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
}
|
||||
)
|
||||
|
||||
const hasAuthors = authors !== undefined
|
||||
---
|
||||
|
||||
<div class="metadata not-content">
|
||||
<time datetime={published_at?published_at:created_at.toString()}>
|
||||
{published_at}
|
||||
<time datetime={dateISO}>
|
||||
{dateLocal}
|
||||
</time>
|
||||
{
|
||||
hasAuthors ? (
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
---
|
||||
import type { Props } from "@astrojs/starlight/props";
|
||||
import AstrolightSiteTitle from "@astrojs/starlight/components/SiteTitle.astro";
|
||||
//import config from 'virtual:starlight-ghost-config'
|
||||
import config from 'virtual:starlight-ghost-config'
|
||||
---
|
||||
|
||||
<AstrolightSiteTitle {...Astro.props} />
|
||||
<div>
|
||||
<a href="/blog">Blog</a>
|
||||
<a href="/blog">{config.title}</a>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
div {
|
||||
align-items: center;
|
||||
gap: var(--sl-nav-gap);
|
||||
font-size: var(--sl-text-h4);
|
||||
font-weight: 600;
|
||||
color: var(--sl-color-text-accent);
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
margin-left: 1rem;
|
||||
border-inline-start: 1px solid var(--sl-color-gray-5);
|
||||
display: none;
|
||||
padding-inline-start: 1rem;
|
||||
}
|
||||
|
||||
@media (min-width: 50rem) {
|
||||
div {
|
||||
display: flex;
|
||||
}
|
||||
padding-inline-start: 1rem;
|
||||
}
|
||||
|
||||
a {
|
||||
|
|
|
@ -18,6 +18,9 @@ const pageProps = getPageProps(config.title)
|
|||
---
|
||||
|
||||
<Page {...pageProps}>
|
||||
{config.supportGhost && (
|
||||
<div id="pghost">Powered by <a href="https://ghost.org">Ghost</a></div>
|
||||
)}
|
||||
<Posts {entries} />
|
||||
<footer class="not-content">
|
||||
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
|
||||
|
@ -32,4 +35,15 @@ const pageProps = getPageProps(config.title)
|
|||
:global(.content-panel:nth-of-type(2)) {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
#pghost {
|
||||
color: gray;
|
||||
margin-top: -1rem;
|
||||
margin-bottom: -0.5rem;
|
||||
}
|
||||
#pghost a {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
|
@ -15,6 +15,10 @@ const configSchema = z
|
|||
* The title of the blog.
|
||||
*/
|
||||
title: z.string().default('Blog'),
|
||||
/**
|
||||
* Turn on and off "Powered by Ghost"
|
||||
*/
|
||||
supportGhost: z.boolean().default(true),
|
||||
})
|
||||
.default({})
|
||||
|
||||
|
|
|
@ -11,8 +11,14 @@ const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
|
|||
"CONTENT_",
|
||||
);
|
||||
|
||||
invariant(CONTENT_API_KEY)
|
||||
invariant(CONTENT_API_URL)
|
||||
invariant(
|
||||
CONTENT_API_KEY,
|
||||
"CONTENT_API_KEY Missing from .env"
|
||||
)
|
||||
invariant(
|
||||
CONTENT_API_URL,
|
||||
"CONTENT_API_URL Missing from .env"
|
||||
)
|
||||
|
||||
const key:ContentAPICredentials["key"] = CONTENT_API_KEY;
|
||||
const url:ContentAPICredentials["url"] = CONTENT_API_URL;
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
console.log(Astro.url.pathname)
|
||||
---
|
||||
hi
|
Loading…
Reference in New Issue