-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用 aurora 主題時,pages 請求內的各 page 的 __page 屬性不會設定上去 #33
Labels
Comments
konnokai
added a commit
to konnokai/hexon
that referenced
this issue
Apr 20, 2023
目前解決方法 Server端
const res = docs.map((pageDoc) => {
const page: BriefPage = transformPageToBrief(transformPage(pageDoc))
page.__page = true // 強制設定值上去
delete page.content
delete page._content
delete page.raw
delete page.more
return page
})
async getPageBySource(source: string): Promise<Page> {
const hexo = await this._hexoInstanceService.getInstance()
const docs = hexo.locals.get("pages").toArray().map(toPage)
const doc = docs.find((item) => item.source === source)
if (!doc || isAsset(doc)) throw new PostOrPageNotFoundError("page")
const res = transformPage(doc)
doc.__page = true // 強制設定值上去
this._logService.log("get page by source", source)
return res
} 不過有時候會遇到請求 Clinet端
export const ZIPage = z.object({
__page: z.boolean().default(true), // 強制設定為 ture
})
export const ZIPost = z.object({
slug: z.string(),
published: z.boolean(),
categories: z.string().array(),
tags: z.string().array(),
__post: z.boolean().default(true), // 既然 page 都改了那就順便改 post 的
}) |
在 server 端 patch 下 |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
錯誤說明
使用 Hexo 內建的
landscape
主題請求http://localhost:4000/proxy/hexo/pages
時正常當主題改用
aurora
後__page
屬性消失網頁顯示的錯誤訊息
且在建立新的 page 時 Hexo 會出現錯誤 (這個錯誤不管使用
landscape
或是aurora
主題都會出現,但使用landscape
主題的話重整頁面後 page 會出現在網頁上)已知情況
使用
aurora
主題時,src\server\services\hexo-service.ts#L253
中的docs
跟res
變數已無__page
屬性不使用
.map(toPage)
直接輸出hexo.locals.get("pages")
的情況亦同猜測
aurora
主題在 generate 階段時將某個東西給移除掉了,或是沒有把__page
屬性補上備註
由於
aurora
主題原作者已停止開發,目前本人有自行 fork 該專案修改,也會追查此問題的導致的原因跟協助處理使用版本
The text was updated successfully, but these errors were encountered: