Skip to content

Commit 84a9f7d

Browse files
fix bad html
1 parent e17987b commit 84a9f7d

7 files changed

Lines changed: 80 additions & 104 deletions

File tree

src/layouts/Layout.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { ClientRouter } from 'astro:transitions';
33
import Header from '../components/Header.astro';
44
import Footer from '../components/Footer.astro';
5+
import PostHog from '../components/posthog.astro';
56
import '../styles/global.css';
67
78
interface Props {
@@ -16,6 +17,7 @@ const { title, description = "Just a dude who enjoys writing code & learning;" }
1617
<html lang="en" class="scroll-smooth">
1718
<head>
1819
<meta charset="utf-8" />
20+
<PostHog />
1921
<meta name="description" content={description} />
2022
<meta name="viewport" content="width=device-width" />
2123
<meta name="generator" content={Astro.generator} />
@@ -51,7 +53,7 @@ const { title, description = "Just a dude who enjoys writing code & learning;" }
5153
style="right: 1rem;"
5254
class="fixed bottom-6 z-40 rounded-full border border-blog-border bg-blog-code-bg/80 px-3 py-2 text-blog-accent shadow-sm transition-all duration-200 hover:text-blog-link hover:border-blog-accent opacity-0 translate-y-2 pointer-events-none cursor-pointer"
5355
>
54-
Top
56+
5557
</button>
5658
<Footer />
5759
<script is:inline>

src/layouts/PostHogLayout.astro

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/pages/404.astro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
2-
import PostHogLayout from '../layouts/PostHogLayout.astro';
32
import Layout from '../layouts/Layout.astro';
43
---
54

6-
<PostHogLayout>
75
<Layout title='404 | KyleUndefined.dev' description='404 Page'>
86
<section class="py-12 md:py-10">
97
<div class="space-y-6">
@@ -28,5 +26,4 @@ import Layout from '../layouts/Layout.astro';
2826
;)
2927
</div>
3028
</section>
31-
</Layout>
32-
</PostHogLayout>
29+
</Layout>

src/pages/blog/[...slug].astro

Lines changed: 76 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,76 @@
1-
---
2-
import { type CollectionEntry, getCollection } from 'astro:content';
3-
import Layout from '../../layouts/Layout.astro';
4-
import PostHogLayout from '../../layouts/PostHogLayout.astro';
5-
import { getReadingTimeLabel } from '../../utils/readingTime';
6-
7-
export async function getStaticPaths() {
8-
const posts = await getCollection('blog');
9-
return posts.map((post) => ({
10-
params: { slug: post.slug },
11-
props: post,
12-
}));
13-
}
14-
type Props = CollectionEntry<'blog'>;
15-
16-
const post = Astro.props;
17-
const { Content, headings } = await post.render();
18-
const tocHeadings = headings.filter((heading) => heading.depth >= 2 && heading.depth <= 3);
19-
const readingTime = getReadingTimeLabel(post.body);
20-
---
21-
22-
<PostHogLayout>
23-
<Layout title={post.data.title} description={post.data.description}>
24-
<div
25-
data-reading-progress
26-
style="transform: scaleX(0);"
27-
class="fixed top-16 left-0 w-full z-50 h-[3px] bg-blog-accent origin-left"
28-
></div>
29-
<section class="py-10 max-w-3xl mx-auto">
30-
<article>
31-
<div class="mb-10 text-center">
32-
<div class="mb-4 text-blog-text">
33-
<time datetime={post.data.pubDate.toISOString()}>
34-
{post.data.pubDate.toLocaleDateString('en-us', {
35-
year: 'numeric',
36-
month: 'long',
37-
day: 'numeric',
38-
})}
39-
</time>
40-
</div>
41-
42-
<h1 class="text-3xl md:text-5xl font-bold mb-6 text-blog-accent leading-tight">
43-
{post.data.title}
44-
</h1>
45-
<h2>{post.data.description}</h2>
46-
<h3 class="mx-auto mt-3 inline-flex rounded-full border border-blog-border bg-blog-code-bg/60 px-3 py-1 text-sm font-medium italic tracking-wide text-blog-link/90">
47-
{readingTime}
48-
</h3>
49-
</div>
50-
51-
{tocHeadings.length > 0 && (
52-
<details class="mb-8 rounded-2xl border border-blog-border bg-blog-code-bg/60 p-4">
53-
<summary class="cursor-pointer text-sm font-semibold uppercase tracking-wide text-blog-accent">
54-
Table of Contents
55-
</summary>
56-
<nav class="mt-4">
57-
<ul class="space-y-2 text-sm text-blog-text">
58-
{tocHeadings.map((heading) => (
59-
<li class:list={[heading.depth === 3 ? 'pl-4' : 'pl-0']}>
60-
<a href={`#${heading.slug}`} class="text-blog-text hover:text-blog-link transition-colors">
61-
{heading.text}
62-
</a>
63-
</li>
64-
))}
65-
</ul>
66-
</nav>
67-
</details>
68-
)}
69-
70-
<div class="prose prose-invert prose-lg max-w-none
71-
prose-headings:font-bold prose-headings:tracking-tight
72-
prose-a:text-blog-link prose-a:no-underline hover:prose-a:no-underline
73-
prose-img:rounded-xl prose-img:shadow-md">
74-
<Content />
75-
</div>
76-
</article>
77-
</section>
78-
</Layout>
79-
</PostHogLayout>
1+
---
2+
import { type CollectionEntry, getCollection } from 'astro:content';
3+
import Layout from '../../layouts/Layout.astro';
4+
import { getReadingTimeLabel } from '../../utils/readingTime';
5+
6+
export async function getStaticPaths() {
7+
const posts = await getCollection('blog');
8+
return posts.map((post) => ({
9+
params: { slug: post.slug },
10+
props: post,
11+
}));
12+
}
13+
type Props = CollectionEntry<'blog'>;
14+
15+
const post = Astro.props;
16+
const { Content, headings } = await post.render();
17+
const tocHeadings = headings.filter((heading) => heading.depth >= 2 && heading.depth <= 3);
18+
const readingTime = getReadingTimeLabel(post.body);
19+
---
20+
21+
<Layout title={post.data.title} description={post.data.description}>
22+
<div
23+
data-reading-progress
24+
style="transform: scaleX(0);"
25+
class="fixed top-16 left-0 w-full z-50 h-[3px] bg-blog-accent origin-left"
26+
></div>
27+
<section class="py-10 max-w-3xl mx-auto">
28+
<article>
29+
<div class="mb-10 text-center">
30+
<div class="mb-4 text-blog-text">
31+
<time datetime={post.data.pubDate.toISOString()}>
32+
{post.data.pubDate.toLocaleDateString('en-us', {
33+
year: 'numeric',
34+
month: 'long',
35+
day: 'numeric',
36+
})}
37+
</time>
38+
</div>
39+
40+
<h1 class="text-3xl md:text-5xl font-bold mb-6 text-blog-accent leading-tight">
41+
{post.data.title}
42+
</h1>
43+
<h2>{post.data.description}</h2>
44+
<h3 class="mx-auto mt-3 inline-flex rounded-full border border-blog-border bg-blog-code-bg/60 px-3 py-1 text-sm font-medium italic tracking-wide text-blog-link/90">
45+
{readingTime}
46+
</h3>
47+
</div>
48+
49+
{tocHeadings.length > 0 && (
50+
<details class="mb-8 rounded-2xl border border-blog-border bg-blog-code-bg/60 p-4">
51+
<summary class="cursor-pointer text-sm font-semibold uppercase tracking-wide text-blog-accent">
52+
Table of Contents
53+
</summary>
54+
<nav class="mt-4">
55+
<ul class="space-y-2 text-sm text-blog-text">
56+
{tocHeadings.map((heading) => (
57+
<li class:list={[heading.depth === 3 ? 'pl-4' : 'pl-0']}>
58+
<a href={`#${heading.slug}`} class="text-blog-text hover:text-blog-link transition-colors">
59+
{heading.text}
60+
</a>
61+
</li>
62+
))}
63+
</ul>
64+
</nav>
65+
</details>
66+
)}
67+
68+
<div class="prose prose-invert prose-lg max-w-none
69+
prose-headings:font-bold prose-headings:tracking-tight
70+
prose-a:text-blog-link prose-a:no-underline hover:prose-a:no-underline
71+
prose-img:rounded-xl prose-img:shadow-md">
72+
<Content />
73+
</div>
74+
</article>
75+
</section>
76+
</Layout>

src/pages/blog/index.astro

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import PostHogLayout from '../../layouts/PostHogLayout.astro';
32
import Layout from '../../layouts/Layout.astro';
43
import PostCard from '../../components/PostCard.astro';
54
import { getCollection } from 'astro:content';
@@ -45,7 +44,6 @@ const monthFilters = [...monthCounts.entries()]
4544
}));
4645
---
4746

48-
<PostHogLayout>
4947
<Layout title="Blog | Kyle Undefined" description="Bloggin what's on the noggin.">
5048
<section class="py-12" data-blog-page>
5149
<h1 class="text-4xl font-bold mb-8 text-blog-accent">Blog</h1>
@@ -263,4 +261,3 @@ const monthFilters = [...monthCounts.entries()]
263261
})();
264262
</script>
265263
</Layout>
266-
</PostHogLayout>

src/pages/index.astro

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import PostHogLayout from '../layouts/PostHogLayout.astro';
32
import Layout from '../layouts/Layout.astro';
43
import PostCard from '../components/PostCard.astro';
54
import ProjectCard from '../components/ProjectCard.astro';
@@ -17,7 +16,6 @@ const projects = (await getCollection('projects'))
1716
const projectsSlice = projects.slice(0, featuredProjectLimit);
1817
---
1918

20-
<PostHogLayout>
2119
<Layout title="Home | KyleUndefined.dev">
2220
<section class="py-12 md:py-10">
2321
<div class="space-y-6">
@@ -76,4 +74,3 @@ const projectsSlice = projects.slice(0, featuredProjectLimit);
7674

7775
<GitHubContributionGrid username="kyle-undefined" />
7876
</Layout>
79-
</PostHogLayout>

src/pages/projects.astro

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import PostHogLayout from '../layouts/PostHogLayout.astro';
32
import Layout from '../layouts/Layout.astro';
43
import ProjectCard from '../components/ProjectCard.astro';
54
import { getCollection } from 'astro:content';
@@ -33,7 +32,6 @@ const getTagSizeClass = (count: number) => {
3332
};
3433
---
3534

36-
<PostHogLayout>
3735
<Layout title="Projects | KyleUndefined.dev" description="Collection of my projects, that I still have, over the years...">
3836
<section class="py-12" data-projects-page>
3937
<div class="max-w-3xl mb-12">
@@ -203,4 +201,3 @@ const getTagSizeClass = (count: number) => {
203201
})();
204202
</script>
205203
</Layout>
206-
</PostHogLayout>

0 commit comments

Comments
 (0)