File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ module.exports = ctx => {
117
117
data . title = data . link . replace ( / ^ h t t p s ? : \/ \/ | \/ $ / g, '' ) ;
118
118
}
119
119
120
+ if ( ! data . title ) {
121
+ data . title = data . slug ;
122
+ }
123
+
120
124
if ( data . permalink ) {
121
125
data . slug = data . permalink ;
122
126
delete data . permalink ;
Original file line number Diff line number Diff line change @@ -615,6 +615,26 @@ describe('post', () => {
615
615
} ) . finally ( ( ) => fs . unlink ( file . source ) ) ;
616
616
} ) ;
617
617
618
+
619
+ it ( 'post - link without title and link' , ( ) => {
620
+ const body = '' ;
621
+
622
+ const file = newFile ( {
623
+ path : 'foo.md' ,
624
+ published : true ,
625
+ type : 'create' ,
626
+ renderable : true
627
+ } ) ;
628
+
629
+ return fs . writeFile ( file . source , body ) . then ( ( ) => process ( file ) ) . then ( ( ) => {
630
+ const post = Post . findOne ( { source : file . path } ) ;
631
+
632
+ post . title . should . eql ( 'foo' ) ;
633
+
634
+ return post . remove ( ) ;
635
+ } ) . finally ( ( ) => fs . unlink ( file . source ) ) ;
636
+ } ) ;
637
+
618
638
it ( 'post - category is an alias for categories' , ( ) => {
619
639
const body = [
620
640
'title: "Hello world"' ,
You can’t perform that action at this time.
0 commit comments