mirror of
https://github.com/YouHaveTrouble/youhavetrouble.github.io.git
synced 2026-08-28 00:56:42 +00:00
Compare commits
2 Commits
4d181f29e7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 712ac88b89 | |||
| 888c3c5ca6 |
@@ -19,11 +19,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout your repository using git
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7.0.1
|
||||
- name: Install, build, and upload your site
|
||||
uses: withastro/action@v2
|
||||
with:
|
||||
node-version: 22
|
||||
node-version: 24
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
|
||||
Generated
+2672
-3922
File diff suppressed because it is too large
Load Diff
+11
-12
@@ -9,19 +9,18 @@
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/mdx": "^3.1.6",
|
||||
"@astrojs/rss": "^4.0.7",
|
||||
"@astrojs/svelte": "^5.7.0",
|
||||
"astro": "^4.15.6",
|
||||
"markdown-it": "^14.1.0",
|
||||
"marked": "^14.1.2",
|
||||
"@astrojs/mdx": "^7.0.5",
|
||||
"@astrojs/rss": "^4.0.19",
|
||||
"astro": "^7.2.0",
|
||||
"markdown-it": "^15.0.0",
|
||||
"marked": "^18.0.9",
|
||||
"reading-time": "^1.5.0",
|
||||
"rehype-external-links": "^3.0.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-smartypants": "^2.1.0",
|
||||
"sanitize-html": "^2.13.0",
|
||||
"sass": "^1.78.0",
|
||||
"sharp": "^0.34.4",
|
||||
"zod": "^3.23.8"
|
||||
"remark-gfm": "^4.0.1",
|
||||
"remark-smartypants": "^3.0.3",
|
||||
"sanitize-html": "^2.17.6",
|
||||
"sass": "^1.102.0",
|
||||
"sharp": "^0.35.3",
|
||||
"zod": "^4.4.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ projects.sort((a, b) => a.data.name.localeCompare(b.data.name));
|
||||
<span>{project.data.description}</span>
|
||||
<span class="links">
|
||||
{
|
||||
project.data.links.map((link) => {
|
||||
project.data.links.map((link: {url: string, text: string}) => {
|
||||
return (
|
||||
<span>
|
||||
<a href={link.url} target="_blank">{link.text}</a>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import {z, defineCollection} from 'astro:content';
|
||||
import {defineCollection} from 'astro:content';
|
||||
import { glob } from "astro/loaders";
|
||||
import { z } from 'astro/zod';
|
||||
|
||||
const posts = defineCollection({
|
||||
type: 'content',
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/posts" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
@@ -11,7 +13,7 @@ const posts = defineCollection({
|
||||
}),
|
||||
});
|
||||
const projects = defineCollection({
|
||||
type: 'content',
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/projects" }),
|
||||
schema: z.object({
|
||||
category: z.string(),
|
||||
name: z.string(),
|
||||
@@ -22,7 +24,7 @@ const projects = defineCollection({
|
||||
}),
|
||||
});
|
||||
const writing = defineCollection({
|
||||
type: 'content',
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/writing" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
publishDate: z.date({coerce: true}),
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import {type CollectionEntry, getCollection} from "astro:content";
|
||||
import {type CollectionEntry, getCollection, render} from "astro:content";
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import Bio from '../../components/Bio.astro';
|
||||
import readingTime from 'reading-time';
|
||||
@@ -8,15 +8,15 @@ export async function getStaticPaths() {
|
||||
const posts = await getCollection('posts');
|
||||
return posts.map(p => ({
|
||||
params: {
|
||||
slug: p.slug
|
||||
slug: p.id
|
||||
},
|
||||
props: {
|
||||
title: p.data.title,
|
||||
description: p.data.description,
|
||||
publishDate: p.data.publishDate,
|
||||
slug: p.slug,
|
||||
slug: p.id,
|
||||
tags: p.data.tags,
|
||||
readTime: readingTime(p.body).text,
|
||||
readTime: readingTime(p.body ?? "").text,
|
||||
},
|
||||
}));
|
||||
}
|
||||
@@ -24,9 +24,9 @@ export async function getStaticPaths() {
|
||||
const {slug, title, description, publishDate, tags, readTime} = Astro.props;
|
||||
const permalink = `${Astro?.site?.href}blog/${slug}`;
|
||||
const posts = await getCollection('posts');
|
||||
const entry: CollectionEntry<'posts'> | undefined = posts.find(e => e.slug === slug);
|
||||
const entry: CollectionEntry<'posts'> | undefined = posts.find(e => e.id === slug);
|
||||
if (!entry) throw new Error(`Post not found: ${slug}`);
|
||||
const { Content } = await entry.render();
|
||||
const { Content } = await render(entry);
|
||||
---
|
||||
|
||||
<BaseLayout title={title} description={description} permalink={permalink} current="blog">
|
||||
@@ -34,7 +34,7 @@ const { Content } = await entry.render();
|
||||
<p>{publishDate} ~ {readTime}</p>
|
||||
<h1 style={`view-transition-name: blog-post-${slug}`}>{title}</h1>
|
||||
<div class="tags" style="justify-content: center">
|
||||
{tags.map(item => (
|
||||
{tags.map((item: string) => (
|
||||
<span class="tag">{item}</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -15,16 +15,16 @@ const allPosts= posts.sort((a, b) => new Date(b.data.publishDate).valueOf() - ne
|
||||
<h1>Blog</h1>
|
||||
{allPosts.length === 0 && <p>No posts as of yet, hop back later!</p>}
|
||||
{allPosts.map((post, index) => {
|
||||
const href = `/blog/${post.slug}`;
|
||||
const href = `/blog/${post.id}`;
|
||||
return (
|
||||
<div>
|
||||
{ index !== 0 && <hr /> }
|
||||
<div class="post-item">
|
||||
<h2>
|
||||
<a data-astro-prefetch href={href} style={`view-transition-name: blog-post-${post.slug}`}>{post.data.title}</a>
|
||||
<a data-astro-prefetch href={href} style={`view-transition-name: blog-post-${post.id}`}>{post.data.title}</a>
|
||||
</h2>
|
||||
<div class="tags">
|
||||
{post.data.tags.map(item => (
|
||||
{post.data.tags.map((item: string) => (
|
||||
<span class="tag">{item}</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -64,13 +64,13 @@ const latestBlogPost = await getCollection("posts")
|
||||
) : null
|
||||
}
|
||||
<div class="latest-article">
|
||||
<span class="title" style={`view-transition-name: blog-post-${latestBlogPost?.slug}`}>{latestBlogPost?.data.title}</span>
|
||||
<span class="title" style={`view-transition-name: blog-post-${latestBlogPost?.id}`}>{latestBlogPost?.data.title}</span>
|
||||
<span class="excerpt">{latestBlogPost?.data.description}</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
{
|
||||
latestBlogPost !== null && (
|
||||
<a href={`/blog/${latestBlogPost?.slug}`} class="button">Read more</a>
|
||||
<a href={`/blog/${latestBlogPost?.id}`} class="button">Read more</a>
|
||||
<a href="/blog" class="button secondary">All articles</a>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ export async function GET(context: { site: any; }) {
|
||||
description: 'Something that\'s supposed to be thoughts.',
|
||||
site: context.site,
|
||||
items: posts.map((post) => ({
|
||||
link: `/blog/${post.slug}/`,
|
||||
content: sanitizeHtml(marked.parse(post.body), {
|
||||
link: `/blog/${post.id}/`,
|
||||
content: sanitizeHtml(marked.parse(post.body ?? ""), {
|
||||
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img'])
|
||||
}),
|
||||
pubDate: new Date(post.data.publishDate),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import {type CollectionEntry, getCollection} from "astro:content";
|
||||
import {type CollectionEntry, getCollection, render} from "astro:content";
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
@@ -7,11 +7,11 @@ export async function getStaticPaths() {
|
||||
const posts = await getCollection('writing');
|
||||
return posts.map(p => ({
|
||||
params: {
|
||||
slug: p.slug
|
||||
slug: p.id
|
||||
},
|
||||
props: {
|
||||
title: p.data.title,
|
||||
slug: p.slug,
|
||||
slug: p.id,
|
||||
},
|
||||
}));
|
||||
}
|
||||
@@ -19,9 +19,9 @@ export async function getStaticPaths() {
|
||||
const {slug, title} = Astro.props;
|
||||
const permalink = `${Astro?.site?.href}writing/${slug}`;
|
||||
const writing = await getCollection('writing');
|
||||
const entry: CollectionEntry<'writing'> | undefined = writing.find(e => e.slug === slug);
|
||||
const entry: CollectionEntry<'writing'> | undefined = writing.find(e => e.id === slug);
|
||||
if (!entry) throw new Error(`Entry not found: ${slug}`);
|
||||
const { Content } = await entry.render();
|
||||
const { Content } = await render(entry);
|
||||
---
|
||||
<BaseLayout title={title} description={""} permalink={permalink} current="writing">
|
||||
<header>
|
||||
|
||||
Reference in New Issue
Block a user