Skip to content

Commit 798a686

Browse files
committed
Solve issue with stylesheet not applying
1 parent 631aac9 commit 798a686

4 files changed

Lines changed: 9 additions & 23 deletions

File tree

src/components/Layout.astro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
import { SEO } from "astro-seo";
3-
import type { Meta } from "astro-seo";
43
54
import Header from "./Header.astro";
65
import Footer from "./Footer.astro";

src/components/Navigation.astro

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { MarkdownInstance } from "astro";
33
import Navlink from "./Navlink.astro";
44
import NavDropdown from "./NavDropdown.astro";
55
import "./Navigation.css";
6+
import { type CollectionEntry, getCollection } from "astro:content";
67
78
interface Frontmatter {
89
title: string;
@@ -11,31 +12,20 @@ interface Frontmatter {
1112
startDate: Date;
1213
finishDate?: Date;
1314
}
14-
const matches = import.meta.glob<MarkdownInstance<Frontmatter>>(
15-
"../pages/projects/*.{md,mdx}",
16-
{ eager: true },
17-
);
18-
const allProjects = Object.values(matches).sort((a, b) => {
15+
16+
const projects = await getCollection("projects");
17+
const sortedProjects = projects.sort((a, b) => {
1918
// If one activity is ongoing, and the other isn't, then onging activity is first
20-
if (!a.frontmatter.finishDate && b.frontmatter.finishDate) {
19+
if (!a.data.finishDate && b.data.finishDate) {
2120
return -1;
2221
}
23-
if (b.frontmatter.finishDate && !b.frontmatter.finishDate) {
22+
if (a.data.finishDate && !b.data.finishDate) {
2423
return 1;
2524
}
2625
27-
// If both are finished, sort by that first
28-
if (a.frontmatter.finishDate && b.frontmatter.finishDate) {
29-
const result = new Date(b.frontmatter.finishDate).getTime() - new Date(a.frontmatter.finishDate).getTime();
30-
if (result != 0) {
31-
return result;
32-
}
33-
}
3426
// Then sort by start date
35-
return new Date(b.frontmatter.startDate).getTime() - new Date(a.frontmatter.startDate).getTime();
27+
return b.data.startDate.getTime() - a.data.startDate.getTime();
3628
});
37-
38-
const size = allProjects.length;
3929
---
4030

4131
<script is:inline>
@@ -63,8 +53,8 @@ const size = allProjects.length;
6353
<NavDropdown title="Technical Projects">
6454
<a href="/projects">All Projects</a>
6555
{
66-
allProjects.map((project) => (
67-
<a href={project.url}>{project.frontmatter.title}</a>
56+
projects.map((project) => (
57+
<a href={project.id}>{project.data.title}</a>
6858
))
6959
}
7060
</NavDropdown>

src/pages/index.astro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
import Layout from "@components/Layout.astro";
3-
import "../styles/global.css";
43
import "../styles/index.css";
54
65
import headshot from "@assets/monserate-headshot.png";

src/pages/projects.astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
import Layout from "@components/Layout.astro";
3-
4-
import "../styles/global.css";
53
import CardGrid from "@components/CardGrid.astro";
64
75
const pageTitle = "Projects";

0 commit comments

Comments
 (0)