Compare commits

..

5 Commits

Author SHA1 Message Date
Julien Calixte
aeb763dd43 chore: optimize images 2026-05-24 00:54:53 +02:00
Julien Calixte
50d8eb31d6 fix(nginx): redirect unknown paths to homepage
Drop the $uri/ directory step in try_files which triggered the default
403 page on directories without an index, and 302 any 403/404 back to /.
2026-05-23 16:52:12 +02:00
Julien Calixte
9e1fae4f2e feat(pub): add /pub index listing all notes 2026-05-23 16:52:08 +02:00
Julien Calixte
d0175025ad feat(home): show only last 15 notes with link to /pub 2026-05-23 16:52:04 +02:00
Julien Calixte
3153200eb3 refactor(notes): sort fetched notes by publishedAt desc
Centralise ordering in fetchNotes so every consumer (homepage, /pub
index, RSS feed) shares the same newest-first order.
2026-05-23 16:52:01 +02:00
19 changed files with 37 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ server {
location / { location / {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html index.htm; index index.html index.htm;
try_files $uri $uri.html $uri/index.html $uri/index.htm $uri/ =404; try_files $uri $uri.html $uri/index.html $uri/index.htm =404;
} }
location /.well-known/ { location /.well-known/ {
@@ -13,11 +13,7 @@ server {
add_header Access-Control-Allow-Methods "GET, OPTIONS"; add_header Access-Control-Allow-Methods "GET, OPTIONS";
} }
error_page 404 /404.html; error_page 403 404 =302 /;
location = /404.html {
root /usr/share/nginx/html;
internal;
}
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -34,5 +34,8 @@ export const fetchNotes = async (): Promise<Note[]> => {
limit: 50, limit: 50,
}) })
return (records || []).map((record) => record.value) const notes = (records || []).map((record) => record.value as Note)
return notes.sort((a, b) =>
a.publishedAt < b.publishedAt ? 1 : a.publishedAt > b.publishedAt ? -1 : 0,
)
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -1,16 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import { fetchNotes } from "@/api/fetch-notes" import { fetchNotes } from "@/api/fetch-notes"
const notes = await fetchNotes() const notes = (await fetchNotes()).slice(0, 15)
</script> </script>
<template> <template>
<div class="blog-notes" v-if="notes.length > 0"> <div class="blog-notes" v-if="notes.length > 0">
<h2>Last notes</h2> <h2>Last notes</h2>
<ul> <ul>
<li v-for="note in notes" :key="note.href"> <li v-for="note in notes" :key="note.path">
<a :href="note.path">{{ note.title }}</a> <a :href="note.path">{{ note.title }}</a>
</li> </li>
</ul> </ul>
<p><a href="/pub">See all articles </a></p>
</div> </div>
</template> </template>

28
src/pages/pub/index.vue Normal file
View File

@@ -0,0 +1,28 @@
<script setup lang="ts">
import { fetchNotes } from "@/api/fetch-notes"
const notes = await fetchNotes()
useHead({
title: "Articles",
})
</script>
<template>
<section class="pub-list">
<h1>Articles</h1>
<ul>
<li v-for="note in notes" :key="note.path">
<a :href="note.path">{{ note.title }}</a>
</li>
</ul>
</section>
</template>
<style scoped lang="scss">
.pub-list {
max-width: 800px;
margin: auto;
padding: 1rem;
}
</style>