Skip to content

Commit dbebba3

Browse files
committed
update
1 parent fab3c3f commit dbebba3

6 files changed

Lines changed: 26 additions & 23 deletions

File tree

astro.config.mjs renamed to astro.config.mts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ export default defineConfig({
1515
output: "server",
1616
adapter: cloudflare({
1717
imageService: "passthrough",
18-
platformProxy: true
18+
platformProxy: {
19+
enabled: true
20+
}
1921
}),
2022
vite: {
2123
define: {
2224
"process.env.API_KEY": JSON.stringify(process.env.API_KEY)
2325
}
2426
}
25-
})
27+
})

src/content/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export const collections = {
77
title: z.string(),
88
description: z.string(),
99
date: z.date(),
10-
tags: z.array(z.string()).default([])
10+
tags: z.array(z.string()).default([]),
11+
published: z.boolean().default(true)
1112
})
1213
})
1314
};

src/pages/blog.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import DateComponent from "@components/Date.astro";
66
import { getCollection } from "astro:content";
77
88
const posts = (await getCollection("blog"))
9+
.filter(post => post.data.published)
910
.sort((left, right) => right.data.date.getTime() - left.data.date.getTime());
1011
---
1112
<Page title="blog" path="~/blog">

src/pages/photos.astro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,11 @@ try {
2727
const filteredPhotos = response.Contents
2828
.filter((obj: any) => obj.Key?.match(/\.(jpg|jpeg|png|gif|webp)$/i))
2929
.filter((obj: any) => !obj.Key?.startsWith("preview_"));
30-
30+
3131
const sortedPhotos = filteredPhotos.sort((a: any, b: any) => {
32-
if (a.Metadata?.time && b.Metadata?.time) {
33-
const timeA = new Date(parseInt(a.Metadata.time) * 1000);
34-
const timeB = new Date(parseInt(b.Metadata.time) * 1000);
35-
return timeB.getTime() - timeA.getTime();
36-
}
3732
return b.Key!.localeCompare(a.Key!);
3833
});
39-
40-
console.table(sortedPhotos.map((obj: any) => ({
41-
filename: obj.Key,
42-
timestamp: obj.Metadata?.time || "NO TIME METADATA",
43-
date: obj.Metadata?.time ? new Date(parseInt(obj.Metadata.time) * 1000).toLocaleString() : "NO TIME METADATA"
44-
})));
45-
34+
4635
photos = sortedPhotos.map((obj: any) => obj.Key!);
4736
}
4837
} catch (err) {

src/pages/rss.xml.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ export async function GET(context: APIContext) {
99
site: context.site!,
1010
title: "mudkip's blog",
1111
description: "welcome to my blog, i will occasionally post my thoughts and things i find interesting here.",
12-
items: posts.map(post => ({
13-
link: `/blog/${post.slug}`,
14-
title: post.data.title,
15-
description: post.data.description,
16-
pubDate: post.data.date,
17-
content: post.body,
18-
})),
12+
items: posts
13+
.filter(post => post.data.published)
14+
.sort((left, right) => right.data.date.getTime() - left.data.date.getTime())
15+
.map(post => ({
16+
link: `/blog/${post.slug}`,
17+
title: post.data.title,
18+
description: post.data.description,
19+
pubDate: post.data.date,
20+
content: post.body,
21+
})),
1922
customData: "<language>en-us</language>",
2023
trailingSlash: false,
2124
})

src/style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,10 @@ button:not(:disabled):active, a.button:not(:disabled):active {
171171
:root:has([data-tooltip]:hover) [data-tooltip]:focus {
172172
display: none !important;
173173
}
174+
175+
/* Code Blocks */
176+
pre:has(code) {
177+
margin: 16px 0;
178+
padding: 16px;
179+
background-color: var(--surface-1) !important;
180+
}

0 commit comments

Comments
 (0)