Skip to content

Commit d0dd2b4

Browse files
author
Jässin
committed
sort blog articles by date
1 parent 1f5fe1d commit d0dd2b4

9 files changed

Lines changed: 35 additions & 17 deletions

app/components/PostMeta.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<Suspense>
33
<template #default>
4-
<p class="min-h-4 text-[var(--background-400)]">{{ page?.meta.date }} · {{ wordCount }} words</p>
4+
<p class="min-h-4 text-[var(--background-400)]">{{new Date(page?.date as string).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) }} · {{ wordCount }} words</p>
55
</template>
66
<template #fallback>
77
<div class="animate-pulse">
@@ -14,7 +14,7 @@
1414
<script setup lang="ts">
1515
const route = useRoute();
1616
17-
const { data: page } = await useAsyncData(route.path + "|meta", () => queryCollection("blog").select("body", "meta").path(route.path).first());
17+
const { data: page } = await useAsyncData(route.path + "|meta", () => queryCollection("blog").select("body", "meta", "date").path(route.path).first());
1818
1919
const wordCount = computed(() => {
2020
if (!page.value?.body) return 0;

app/pages/blog/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{{ post.title }}
1717
</h2>
1818
<div class="text-sm text-[var(--text-600)]">
19-
{{ post.meta.date }}
19+
{{ new Date(post.date as string).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) }}
2020
</div>
2121
<div v-if="post.description" class="text-[var(--text-700)] mb-4">
2222
{{ post.description }}
@@ -44,7 +44,8 @@ const { data: articles } = await useAsyncData("blogposts", () =>
4444
.where("id", "NOT LIKE", "%.draft.md")
4545
.where("title", "NOT LIKE", "Placeholder")
4646
.where("title", "NOT LIKE", "%unlisted%")
47-
.select("id", "meta", "path", "title", "description")
47+
.select("id", "meta", "date", "path", "title", "description")
48+
.order("date", "DESC")
4849
.all()
4950
);
5051

content.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineContentConfig, defineCollection } from "@nuxt/content";
1+
import { defineContentConfig, defineCollection, z } from "@nuxt/content";
22

33
export default defineContentConfig({
44
collections: {
@@ -9,6 +9,13 @@ export default defineContentConfig({
99
blog: defineCollection({
1010
type: "page",
1111
source: "blog/**/*.md",
12+
schema: z.object({
13+
date: z.string(),
14+
meta: z.object({
15+
date: z.string(),
16+
image: z.string().optional()
17+
}),
18+
})
1219
}),
1320
},
1421
});

content/blog/Hosting my own Mailserver.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: My domain provider for my other domain doesn't offer E-Mail. So I
44
was wondering how I can self-host a mailserver on my own. It turned out to be
55
a lot more of a pain than expected, but here is my process.
66
tags: docker, mail, email, self-host, mailserver
7-
date: 26.11.2024
7+
date: "2024-11-26"
88
image: /images/blog-thumbnails/docker-mailserver.webp
99
---
1010

@@ -36,10 +36,12 @@ Funnily enough, that doesn't change that the IP adress range of mine is **blackl
3636
Actually running the server is as easy as getting the files, setting up the .env variables and running `docker compose up -d`.
3737

3838
::code-with-copy-button
39+
3940
```bash [get-docker-mailserver.sh]
4041
wget "${DMS_GITHUB_URL}/compose.yaml"
4142
wget "${DMS_GITHUB_URL}/mailserver.env"
4243
```
44+
4345
::
4446

4547
Now your server should be running! Use `docker exec -ti <CONTAINER NAME> setup` to check out all the commands you'll need for adding users and stuff like that.

content/blog/I finally switched to Linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: I finally switched to Linux!
33
description: The enshittification of Windows has gotten to a point where users are actively looking for alternatives now. I was -wanting- to make the switch to Linux for a long time, but just never mustered up the courage to daily drive it for long enough. Until now!
44
tags: docker, mail, email, self-host, mailserver
5-
date: 15.02.2026
5+
date: "2026-02-15"
66
image: /images/blog-thumbnails/linux.webp
77
---
88

content/blog/My Website with Nuxt Content.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: In November 2024 I decided to rewrite my website, since it was
44
outdated and I decided that it needed a touch up. Here's the process of how I
55
did it, and what decisions I made along the way.
66
tags: website, content, vue, nuxt, github, docker, blog
7-
date: 23.11.2024
7+
date: "2024-11-23"
88
image: /images/blog-thumbnails/probablyjassin.webp
99
---
1010

@@ -17,22 +17,24 @@ image: /images/blog-thumbnails/probablyjassin.webp
1717
What was clear from the start, is that I wanted to use [Nuxt.js](https://nuxt.com/) (based on [Vue](https://vuejs.org)), since that's what I know best and prefer.
1818

1919
::code-with-copy-button
20+
2021
```vue [page.vue]
2122
<script setup>
22-
import { ref } from "vue";
23-
const count = ref(0);
23+
import { ref } from "vue";
24+
const count = ref(0);
2425
</script>
2526
2627
<template>
27-
<button @click="count++">Count is: {{ count }}</button>
28+
<button @click="count++">Count is: {{ count }}</button>
2829
</template>
2930
3031
<style scoped>
31-
button {
32-
font-weight: bold;
33-
}
32+
button {
33+
font-weight: bold;
34+
}
3435
</style>
3536
```
37+
3638
::
3739

3840
I find single-file components to be pretty simple and easy to get behind. It's not the most popular framework, but it has a great community with great support for what matters to me:
@@ -60,6 +62,7 @@ The challenge is that Nuxt Content seemingly requires [SSR (Server Side Renderin
6062
So here is the current pipeline for how my Website is deployed:
6163

6264
::code-with-copy-button
65+
6366
```yaml [workflow.yml]
6467
jobs:
6568
  build-and-push:
@@ -80,11 +83,13 @@ jobs:
8083
          username: ${{ github.actor }}
8184
          password: ${{ secrets.GITHUB_TOKEN }}
8285
```
86+
8387
::
8488
8589
We log into the container registry and checkout the codebase to get ready for building
8690
8791
::code-with-copy-button
92+
8893
```yaml [workflow.yml]
8994
- name: Check for existing cache
9095
id: cache-check
@@ -119,11 +124,13 @@ We log into the container registry and checkout the codebase to get ready for bu
119124
restore-keys: |
120125
${{ runner.os }}-buildx-
121126
```
127+
122128
::
123129
124130
We want to cache the Docker layers to improve the time it takes to run this workflow, but also have to manage deleting this cache if it became invalid. Same goes for old package versions. GitHub keeps these around by default, but for a project like this, I don't want that. So I made the workflow delete them.
125131
126132
::code-with-copy-button
133+
127134
```yaml [workflow.yml]
128135
- name: Build and push Docker image
129136
uses: docker/build-push-action@v6
@@ -136,6 +143,7 @@ We want to cache the Docker layers to improve the time it takes to run this work
136143
cache-from: type=local,src=/tmp/.buildx-cache
137144
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
138145
```
146+
139147
::
140148
141149
And at last, we build and push the Docker Image, to be pulled down by me and hosted.

content/blog/Self-Hosting projects without exposing the home network.draft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Self Hosting Projects Without Exposing The Home Network
33
description: Most of the websites and projects I make are self-hosted. But how
44
is this done without exposing my home network?
5-
date: 23.11.2024
5+
date: "2024-11-13"
66
image: /images/blog-thumbnails/probablyjassin.webp
77
---
88

content/blog/a-small-rant-on-the-horrible-website-my-university-uses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: A small rant on the website my university uses
33
description: As with most Schools and Universities (especially in Germany), my Unis website is very old. These are my biggest problems with their page, and what I alternatives we found
4-
date: 20.10.2025
4+
date: "2025-10-20"
55
image: /images/blog-thumbnails/sap.webp
66
---
77

content/blog/cs24-stunden.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: unlisted
3-
date: 28.10.2025
3+
date: 2025-10-28
44
thumbnail: /images/blog-images/cs24-stunden/aufmerksamkeit.webp
55
description:
66
Helluuu, die ominöse Zahl von 70% Anwesenheit lässt sich ja bekanntlich nie

0 commit comments

Comments
 (0)