Merge pull request #4 from ghall89/dev

fixes
This commit is contained in:
Graham Hall
2022-12-10 23:15:08 -05:00
committed by GitHub
5 changed files with 40 additions and 23 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ const title = Astro.props.frontmatter
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
<title>{`ghall.blog - ${title}`}</title>
</head>
<body class="container">
<Header />
+10
View File
@@ -0,0 +1,10 @@
---
layout: ../layouts/Layout.astro
title: "About"
---
## 404 - Page not found!
You're trying to find a page that does not exist.
[Click here](/) to find your way home.
+23 -19
View File
@@ -15,24 +15,28 @@ const response = await fetch(
const posts = await response.json();
---
<Layout title="Blog">
<div>
{
posts.objects.map((post) => (
<article>
{post.thumbnail ? (
<div style={{ marginBottom: "25px" }}>
<img src={post.thumbnail} alt={`Thumbnail for ${post.title}`} />
</div>
) : null}
<div>
<BlogHeader title={post.title} date={post.published_at} />
<Markup content={`<p>${post.content.split("</p>")[0]}`} />
<a href={`/posts/${post.slug}`}>Read More</a>
<Layout title="Home">
{
posts.objects.map((post) => (
<article>
{post.thumbnail ? (
<div style={{ marginBottom: "25px" }}>
<img src={post.thumbnail} alt={`Thumbnail for ${post.title}`} />
</div>
</article>
))
}
{posts.objects.length < 5 ? null : <a href="/archive">More Posts</a>}
</div>
) : null}
<div>
<BlogHeader title={post.title} date={post.published_at} />
<Markup content={`<p>${post.content.split("</p>")[0]}`} />
<a href={`/posts/${post.slug}`}>Read More</a>
</div>
</article>
))
}
{posts.objects.length < 5 ? null : <a href="/archive">All Posts</a>}
</Layout>
<!-- <style>
blog-post {
article
}
</style> -->
+4 -1
View File
@@ -7,15 +7,18 @@ import BlogHeader from "../../components/BlogHeader.astro";
const { slug } = Astro.params;
console.log(`SLUG: ${slug}`);
const response = await fetch(
`https://api.cosmicjs.com/v2/buckets/${
import.meta.env.BUCKET_SLUG
}/objects?pretty=true&query=%7B%22type%22%3A%22blog-posts%22%7D&read_key=${
import.meta.env.BUCKET_READ_KEY
}&limit=20&slug=${slug}`
}&limit=5&query=%7B%22slug%22%3A%7B%22%24eq%22%3A%22${slug}%22%7D%7D`
);
const posts = await response.json();
const post = posts.objects[0];
---
@@ -1,13 +1,13 @@
---
import { format } from "date-fns";
import Layout from "../layouts/Layout.astro";
import Layout from "../../layouts/Layout.astro";
const response = await fetch(
`https://api.cosmicjs.com/v2/buckets/${
import.meta.env.BUCKET_SLUG
}/objects?pretty=true&query=%7B%22type%22%3A%22blog-posts%22%7D&read_key=${
import.meta.env.BUCKET_READ_KEY
}&skip=5&limit=25`
}&limit=25`
);
const posts = await response.json();