Skip to content

Commit b804934

Browse files
committed
chore: update from hexojs/pull/5153
PR hexojs#5153 Commit hexojs@8b95bbc
1 parent d0dbc8e commit b804934

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/models/post_asset.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import warehouse from 'warehouse';
2-
import { join } from 'path';
2+
import { dirname, join } from 'path';
33

4-
export = ctx => {
4+
export = (ctx: import('../hexo')) => {
55
const PostAsset = new warehouse.Schema({
6-
_id: {type: String, required: true},
7-
slug: {type: String, required: true},
8-
modified: {type: Boolean, default: true},
9-
post: {type: warehouse.Schema.Types.CUID, ref: 'Post'},
10-
renderable: {type: Boolean, default: true}
6+
_id: { type: String, required: true },
7+
slug: { type: String, required: true },
8+
modified: { type: Boolean, default: true },
9+
post: { type: warehouse.Schema.Types.CUID, ref: 'Post' },
10+
renderable: { type: Boolean, default: true }
1111
});
1212

1313
PostAsset.virtual('path').get(function() {
@@ -17,8 +17,8 @@ export = ctx => {
1717

1818
// PostAsset.path is file path relative to `public_dir`
1919
// no need to urlescape, #1562
20-
// strip /\.html?$/ extensions on permalink, #2134
21-
return join(post.path.replace(/\.html?$/, ''), this.slug);
20+
// strip extensions better on permalink, #2134
21+
return join(dirname(post.path), post.slug, this.slug);
2222
});
2323

2424
PostAsset.virtual('source').get(function() {

0 commit comments

Comments
 (0)