Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/pages/changelog/[slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const slug = route.params.slug as string

const { data: entry, error } = await useFetch<ChangelogListItem>(`/api/changelogs/${slug}`)

// Keep the not-found message, but answer 404 like the help article page does.
if (import.meta.server && error.value) {
setResponseStatus(useRequestEvent()!, 404)
}

const coverUrl = computed(() => resolveAttachmentUrl(entry.value?.cover))

const timeAgo = useTimeAgo()
Expand Down
7 changes: 6 additions & 1 deletion app/pages/p/[slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ const boardStore = useBoardStore()
await callOnce(() => boardStore.fetchBoards())

// SSR: fetch via useFetch (payload auto-transferred), then hydrate store on both sides
const { data: postData } = await useFetch<PostDetail>(`/api/posts/${slug}`)
const { data: postData, error: postError } = await useFetch<PostDetail>(`/api/posts/${slug}`)
// A missing post is a 404, not an empty page with 200 (a "soft 404" that search
// engines index and link checkers cannot see).
if (postError.value?.statusCode === 404) {
throw createError({ statusCode: 404, statusMessage: 'Not Found', fatal: true })
}
if (postData.value) {
store.setPost(slug, postData.value)
}
Expand Down