Generated
+18
-2
@@ -12,7 +12,7 @@
|
||||
"@picocss/pico": "^1.5.6",
|
||||
"astro": "^1.6.13",
|
||||
"astro-remote": "^0.2.3",
|
||||
"date-fns": "^2.29.3"
|
||||
"date-fns-tz": "^1.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.8.1",
|
||||
@@ -1414,6 +1414,7 @@
|
||||
"version": "2.29.3",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz",
|
||||
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.11"
|
||||
},
|
||||
@@ -1422,6 +1423,14 @@
|
||||
"url": "https://opencollective.com/date-fns"
|
||||
}
|
||||
},
|
||||
"node_modules/date-fns-tz": {
|
||||
"version": "1.3.7",
|
||||
"resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-1.3.7.tgz",
|
||||
"integrity": "sha512-1t1b8zyJo+UI8aR+g3iqr5fkUHWpd58VBx8J/ZSQ+w7YrGlw80Ag4sA86qkfCXRBLmMc4I2US+aPMd4uKvwj5g==",
|
||||
"peerDependencies": {
|
||||
"date-fns": ">=2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
@@ -6749,7 +6758,14 @@
|
||||
"date-fns": {
|
||||
"version": "2.29.3",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz",
|
||||
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA=="
|
||||
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==",
|
||||
"peer": true
|
||||
},
|
||||
"date-fns-tz": {
|
||||
"version": "1.3.7",
|
||||
"resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-1.3.7.tgz",
|
||||
"integrity": "sha512-1t1b8zyJo+UI8aR+g3iqr5fkUHWpd58VBx8J/ZSQ+w7YrGlw80Ag4sA86qkfCXRBLmMc4I2US+aPMd4uKvwj5g==",
|
||||
"requires": {}
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.4",
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
"@picocss/pico": "^1.5.6",
|
||||
"astro": "^1.6.13",
|
||||
"astro-remote": "^0.2.3",
|
||||
"date-fns": "^2.29.3"
|
||||
"date-fns-tz": "^1.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.8.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import { format } from "date-fns";
|
||||
import { formatInTimeZone } from "date-fns-tz";
|
||||
|
||||
interface Props {
|
||||
title: String;
|
||||
@@ -11,5 +11,7 @@ const { title, date } = Astro.props;
|
||||
|
||||
<div class="blog-header">
|
||||
<h4>{title}</h4>
|
||||
<h5>{`🗓️ ${format(new Date(date), "MMM do, y")}`}</h5>
|
||||
<h5>
|
||||
{`🗓️ ${formatInTimeZone(new Date(date), "America/New_York", "MMM do, y")}`}
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
import { format } from "date-fns";
|
||||
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`
|
||||
);
|
||||
|
||||
const posts = await response.json();
|
||||
---
|
||||
|
||||
<Layout title="Blog Archive">
|
||||
{
|
||||
posts.objects.map((post) => (
|
||||
<div>
|
||||
<a href={`/${post.slug}`}>{post.title}</a> -{" "}
|
||||
{format(new Date(post.published_at), "MMM do, y")}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</Layout>
|
||||
@@ -9,7 +9,7 @@ const response = await fetch(
|
||||
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=10`
|
||||
}&limit=5`
|
||||
);
|
||||
|
||||
const posts = await response.json();
|
||||
@@ -33,5 +33,6 @@ const posts = await response.json();
|
||||
</article>
|
||||
))
|
||||
}
|
||||
{posts.objects.length < 5 ? null : <a href="/archive">More Posts</a>}
|
||||
</div>
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user