fix: archive page slug

This commit is contained in:
DIYgod 2023-07-30 00:38:48 +01:00
parent 666763c12e
commit 8792d9218e
No known key found for this signature in database
1 changed files with 12 additions and 8 deletions

View File

@ -15,6 +15,7 @@ import { gql } from "@urql/core"
import { expandCrossbellNote } from "~/lib/expand-unit"
import { filterCommentCharacter } from "~/lib/filter-character"
import { getNoteSlug } from "~/lib/helpers"
import { checkSlugReservedWords } from "~/lib/slug-reserved-words"
import { getKeys, getStorage } from "~/lib/storage"
import { ExpandedNote, PageVisibilityEnum } from "~/lib/types"
@ -186,14 +187,17 @@ export async function getPagesBySite(input: {
pinnedNoteId: pinnedNote?.noteId,
list: await Promise.all(
list.map(async (note) => {
const expanded = input.skipExpansion
? (note as ExpandedNote)
: await expandCrossbellNote({
note,
useStat: input.useStat,
useHTML: input.useHTML,
useScore: false,
})
let expanded = note as ExpandedNote
if (input.skipExpansion) {
expanded.metadata.content.slug = getNoteSlug(expanded)
} else {
expanded = await expandCrossbellNote({
note,
useStat: input.useStat,
useHTML: input.useHTML,
useScore: false,
})
}
if (!input.keepBody) {
delete expanded.metadata?.content?.content