Skip to content

Commit 752bcef

Browse files
committed
feat: research with topics, teaching in order
1 parent 1b19e53 commit 752bcef

File tree

3 files changed

+76
-57
lines changed

3 files changed

+76
-57
lines changed

content.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default defineContentConfig({
2626
})),
2727
cta: z.string().optional(),
2828
date: z.string().optional(),
29+
type: z.string(),
2930
}),
3031
}),
3132
source: 'research/*.md',

pages/research.vue

Lines changed: 67 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,78 @@
11
<template>
22
<div>
3-
<PageTitle>Research</PageTitle>
43
<div class="fl-column aself-start standard-padding">
5-
<Motion
6-
v-for="(res) in research"
7-
:key="res.title"
8-
class="publication"
9-
:initial="{ opacity: 0, y: 30 }"
10-
:in-view="{ opacity: 1, y: 0 }"
11-
:in-view-options="{ once: true, amount: 'some' }"
12-
:transition="{ duration: 0.9 }"
4+
<div
5+
v-for="([resType, resArr]) in Object.entries(research!)"
6+
:key="resType"
137
>
14-
<div class="title-container">
15-
<component
16-
:is="res.meta.title_link ? 'a' : 'div'"
17-
:href="res.meta.title_link ? res.meta.title_link : null"
18-
class="title small"
19-
>
20-
{{ res.title }}
21-
</component>
22-
<div
23-
v-if="res.meta.coauthors"
24-
class="coauthors copy small"
25-
>
26-
with
27-
<span
28-
v-for="(c, index) in res.meta.coauthors"
29-
:key="c.coauthor.name"
30-
class="coauthor"
8+
<PageTitle style="margin-left: 0; padding-left: 0;">
9+
{{ resType }}
10+
</PageTitle>
11+
<Motion
12+
v-for="(res) in resArr"
13+
:key="res.title"
14+
class="publication"
15+
:initial="{ opacity: 0, y: 30 }"
16+
:in-view="{ opacity: 1, y: 0 }"
17+
:in-view-options="{ once: true, amount: 'some' }"
18+
:transition="{ duration: 0.9 }"
19+
>
20+
<div class="title-container">
21+
<component
22+
:is="res.meta.title_link ? 'a' : 'div'"
23+
:href="res.meta.title_link ? res.meta.title_link : null"
24+
class="title small"
25+
>
26+
{{ res.title }}
27+
</component>
28+
<div
29+
v-if="res.meta.coauthors"
30+
class="coauthors copy small"
31+
>
32+
with
33+
<span
34+
v-for="(c, index) in res.meta.coauthors"
35+
:key="c.coauthor.name"
36+
class="coauthor"
37+
>
38+
<a
39+
v-if="c.coauthor.link"
40+
:href="c.coauthor.link"
41+
>{{ c.coauthor.name }}</a>
42+
<span v-else>{{ c.coauthor.name }}</span>{{ getLigature(res.meta.coauthors, index) }}
43+
</span>
44+
</div>
45+
<div
46+
v-if="res.meta.links && res.meta.links.length"
47+
ref="links"
48+
class="links"
3149
>
3250
<a
33-
v-if="c.coauthor.link"
34-
:href="c.coauthor.link"
35-
>{{ c.coauthor.name }}</a>
36-
<span v-else>{{ c.coauthor.name }}</span>{{ getLigature(res.meta.coauthors, index) }}
37-
</span>
51+
v-for="link in res.meta.links"
52+
:key="link.link"
53+
class="link"
54+
target="_blank"
55+
:href="link.link"
56+
>{{
57+
link.label }}</a>
58+
</div>
3859
</div>
39-
<div
40-
v-if="res.meta.links && res.meta.links.length"
41-
ref="links"
42-
class="links"
43-
>
44-
<a
45-
v-for="link in res.meta.links"
46-
:key="link.link"
47-
class="link"
48-
target="_blank"
49-
:href="link.link"
50-
>{{
51-
link.label }}</a>
60+
<div class="copy small">
61+
<ContentRenderer :value="res" />
5262
</div>
53-
</div>
54-
<div class="copy small">
55-
<ContentRenderer :value="res" />
56-
</div>
57-
<a
58-
v-if="res.meta.cta"
59-
class="external copy small"
60-
:href="res.meta.cta"
61-
>Read Me</a>
62-
</Motion>
63+
<a
64+
v-if="res.meta.cta"
65+
class="external copy small"
66+
:href="res.meta.cta"
67+
>Read Me</a>
68+
</Motion>
69+
</div>
6370
</div>
6471
</div>
6572
</template>
6673

6774
<script setup lang="ts">
75+
import type { ResearchCollectionItem } from '@nuxt/content'
6876
import anime from 'animejs'
6977
7078
const { data: research } = await useAsyncData('research', async () => {
@@ -74,7 +82,11 @@ const { data: research } = await useAsyncData('research', async () => {
7482
const dateB = new Date(b.meta.date ?? '1970-01-01')
7583
7684
return dateB.getTime() - dateA.getTime()
77-
})
85+
}).reduce((acc: Record<string, ResearchCollectionItem[]>, v) => {
86+
acc[v.meta.type] ??= []
87+
acc[v.meta.type].push(v)
88+
return acc
89+
}, {})
7890
})
7991
useHead({
8092
title: `Research`,

pages/teaching.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ useHead({
3636
title: 'Teaching',
3737
})
3838
39-
const { data: teaching } = await useAsyncData('teaching', () => {
40-
return queryCollection('teaching').all()
39+
const { data: teaching } = await useAsyncData('teaching', async () => {
40+
const qCollection = await queryCollection('teaching').all()
41+
return qCollection.sort((a, b) => {
42+
const dateA = new Date(a.meta.date ?? '1970-01-01')
43+
const dateB = new Date(b.meta.date ?? '1970-01-01')
44+
45+
return dateB.getTime() - dateA.getTime()
46+
})
4147
})
4248
4349
onMounted(() => {

0 commit comments

Comments
 (0)