Compare commits
4 Commits
ffad0ecf54
...
50d8eb31d6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50d8eb31d6 | ||
|
|
9e1fae4f2e | ||
|
|
d0175025ad | ||
|
|
3153200eb3 |
@@ -4,7 +4,7 @@ server {
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
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/ {
|
||||
@@ -13,11 +13,7 @@ server {
|
||||
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
location = /404.html {
|
||||
root /usr/share/nginx/html;
|
||||
internal;
|
||||
}
|
||||
error_page 403 404 =302 /;
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
|
||||
@@ -34,5 +34,8 @@ export const fetchNotes = async (): Promise<Note[]> => {
|
||||
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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { fetchNotes } from "@/api/fetch-notes"
|
||||
|
||||
const notes = await fetchNotes()
|
||||
const notes = (await fetchNotes()).slice(0, 15)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="blog-notes" v-if="notes.length > 0">
|
||||
<h2>Last notes</h2>
|
||||
<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>
|
||||
</li>
|
||||
</ul>
|
||||
<p><a href="/pub">See all articles →</a></p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
28
src/pages/pub/index.vue
Normal file
28
src/pages/pub/index.vue
Normal 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>
|
||||
Reference in New Issue
Block a user