File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
examples/blog/pages/posts Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' nextra-theme-blog ' : minor
3
+ ---
4
+
5
+ support draft posts via frontMatter's ` draft: true ` value
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Draft
3
+ date : 2023/6/28
4
+ description : An example of a draft post.
5
+ draft : true
6
+ tag : web development
7
+ author : Ada Lovelace
8
+ ---
9
+
10
+ Because this post has ` draft: true ` defined in its frontmatter, it won't show up
11
+ in the [ list of posts] ( /posts ) or
12
+ [ list of posts by tag] ( /tags/web%20development ) but can be access directly by
13
+ its url at [ /posts/draft] ( /posts/draft ) .
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ const isPost = (page: PageMapItem): page is MdxFile => {
14
14
page . name . startsWith ( '_' )
15
15
)
16
16
return false
17
- const type = page . frontMatter ?. type
18
- return ! type || type === 'post'
17
+ const { draft , type } = page . frontMatter || { }
18
+ return ! draft && ( ! type || type === 'post' )
19
19
}
20
20
21
21
export const collectPostsAndNavs = ( { opts } : LayoutProps ) => {
You can’t perform that action at this time.
0 commit comments