blog slug fixes

This commit is contained in:
2022-12-10 23:14:25 -05:00
parent a2d9f2c029
commit b3303e6796
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.
+8 -4
View File
@@ -15,8 +15,7 @@ const response = await fetch(
const posts = await response.json();
---
<Layout title="Blog">
<div>
<Layout title="Home">
{
posts.objects.map((post) => (
<article>
@@ -33,6 +32,11 @@ const posts = await response.json();
</article>
))
}
{posts.objects.length < 5 ? null : <a href="/archive">More Posts</a>}
</div>
{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();