Compare commits

..

1 Commits

Author SHA1 Message Date
tiff
2877f96fee Update something 2025-05-17 21:18:28 -04:00
8 changed files with 1316 additions and 6561 deletions

View File

@ -10,14 +10,17 @@ import expressiveCode from "astro-expressive-code";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
site: SITE.website, site: SITE.website,
integrations: [sitemap({ integrations: [
filter: page => SITE.showArchives || !page.endsWith("/archives"), sitemap({
}), expressiveCode()], filter: (page) => SITE.showArchives || !page.endsWith("/archives"),
}),
expressiveCode(),
],
markdown: { markdown: {
remarkPlugins: [remarkToc, [remarkCollapse, { test: "Table of contents" }]], remarkPlugins: [remarkToc, [remarkCollapse, { test: "Table of contents" }]],
shikiConfig: { shikiConfig: {
// For more themes, visit https://shiki.style/themes // For more themes, visit https://shiki.style/themes
themes: { light: "min-light", dark: "night-owl" }, themes: { light: "catppuccin-latte", dark: "catppuccin-frappe" },
wrap: true, wrap: true,
}, },
}, },
@ -30,10 +33,10 @@ export default defineConfig({
image: { image: {
// Used for all Markdown images; not configurable per-image // Used for all Markdown images; not configurable per-image
// Used for all `<Image />` and `<Picture />` components unless overridden with a prop // Used for all `<Image />` and `<Picture />` components unless overridden with a prop
experimentalLayout: "responsive", experimentalLayout: "full-width",
}, },
experimental: { experimental: {
svg: true,
responsiveImages: true, responsiveImages: true,
}, },
}); });

View File

@ -21,12 +21,13 @@
"@resvg/resvg-js": "^2.6.2", "@resvg/resvg-js": "^2.6.2",
"@tailwindcss/vite": "^4.0.12", "@tailwindcss/vite": "^4.0.12",
"@types/sanitize-html": "^2.13.0", "@types/sanitize-html": "^2.13.0",
"astro": "^5.4.2", "astro": "^5.7.13",
"astro-expressive-code": "^0.40.2", "astro-expressive-code": "^0.40.2",
"lodash.kebabcase": "^4.1.1", "lodash.kebabcase": "^4.1.1",
"markdown-it": "^14.1.0", "markdown-it": "^14.1.0",
"remark-collapse": "^0.1.2", "remark-collapse": "^0.1.2",
"remark-toc": "^9.0.0", "remark-toc": "^9.0.0",
"sanitize-html": "^2.17.0",
"satori": "^0.12.1", "satori": "^0.12.1",
"sharp": "^0.33.5", "sharp": "^0.33.5",
"tailwindcss": "^4.0.12" "tailwindcss": "^4.0.12"

5794
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
export const SITE = { export const SITE = {
website: "https://tiff.engineer/", // replace this with your deployed domain website: "https://tiff.run/", // replace this with your deployed domain
author: "tiff w", author: "tiff w",
profile: "https://about.tiff.engineer/", profile: "https://about.tiff.run/",
desc: "A software blog by someone named tiff.", desc: "A software blog by someone named tiff.",
title: "tiff on software", title: "tiff on software",
ogImage: "astropaper-og.jpg", ogImage: "astropaper-og.jpg",

View File

@ -14,7 +14,7 @@ const blog = defineCollection({
draft: z.boolean().optional(), draft: z.boolean().optional(),
tags: z.array(z.string()).default(["others"]), tags: z.array(z.string()).default(["others"]),
ogImage: image() ogImage: image()
.refine(img => img.width >= 1200 && img.height >= 630, { .refine((img) => img.width >= 1200 && img.height >= 630, {
message: "OpenGraph image must be at least 1200 X 630 pixels!", message: "OpenGraph image must be at least 1200 X 630 pixels!",
}) })
.or(z.string()) .or(z.string())

17
src/pages/rss.xml Normal file
View File

@ -0,0 +1,17 @@
import rss from '@astrojs/rss';
import sanitizeHtml from 'sanitize-html';
export async function GET(context) {
const postImportResult = import.meta.glob('../posts/**/*.md', { eager: true });
const posts = Object.values(postImportResult);
return rss({
title: 'tiff on software',
description: 'A humble Astronauts guide to the stars',
site: context.site,
items: await Promise.all(posts.map(async (post) => ({
link: post.url,
content: sanitizeHtml((await post.compiledContent())),
...post.frontmatter,
}))),
});
}

View File

@ -1,8 +1,12 @@
import rss from "@astrojs/rss"; import rss from "@astrojs/rss";
import { getCollection } from "astro:content"; import { getCollection } from "astro:content";
import getSortedPosts from "@/utils/getSortedPosts"; import getSortedPosts from "@/utils/getSortedPosts";
import sanitizeHtml from "sanitize-html";
import MarkdownIt from "markdown-it";
import { SITE } from "@/config"; import { SITE } from "@/config";
const parser = new MarkdownIt();
export async function GET() { export async function GET() {
const posts = await getCollection("blog"); const posts = await getCollection("blog");
const sortedPosts = getSortedPosts(posts); const sortedPosts = getSortedPosts(posts);
@ -12,9 +16,13 @@ export async function GET() {
site: SITE.website, site: SITE.website,
items: sortedPosts.map(({ data, id }) => ({ items: sortedPosts.map(({ data, id }) => ({
link: `posts/${id}/`, link: `posts/${id}/`,
content: sanitizeHtml(parser.render(posts.body), {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
}),
title: data.title, title: data.title,
description: data.description, description: data.description,
pubDate: new Date(data.modDatetime ?? data.pubDatetime), pubDate: new Date(data.modDatetime ?? data.pubDatetime),
customData: `<summary>${posts.frontmatter.description}</summary>`,
})), })),
}); });
} }

2032
yarn.lock

File diff suppressed because it is too large Load Diff