more progress and its working

This commit is contained in:
Adam Matthiesen 2024-02-20 01:41:07 -08:00
parent 8be237e3cc
commit c05eb632dd
6 changed files with 54 additions and 20 deletions

View File

@ -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 ? (

View File

@ -1,26 +1,28 @@
---
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 {
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;
display: flex;
padding-inline-start: 1rem;
}
@media (min-width: 50rem) {
div {
display: flex;
}
}
}
a {
color: var(--sl-color-text-accent);

View File

@ -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>

View File

@ -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({})

View File

@ -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;

View File

@ -1,4 +0,0 @@
---
console.log(Astro.url.pathname)
---
hi