Skip to main content

get_post_preview

Function get_post_preview 

Source
pub async fn get_post_preview(
    slug: String,
) -> Result<SinglePostResponse, ServerFnError>
Expand description

管理员按 slug 预览文章(含草稿),不缓存、不带上下篇导航。

镜像 get_post_by_id 的查询,但按 slug 取、不做 status = 'published' 过滤,故草稿可被预览。回收站(软删除)文章返回 None。草稿绝不进公开缓存 (cache::get/set_post_by_slug),因此预览路径只走一次直查。

§Handler information

  • Method: post
  • Path: <auto>