Skip to content

Commit

Permalink
chore: update from hexojs/pull/5153
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaslanjaka committed May 2, 2023
1 parent d0dbc8e commit b804934
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/models/post_asset.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import warehouse from 'warehouse';
import { join } from 'path';
import { dirname, join } from 'path';

export = ctx => {
export = (ctx: import('../hexo')) => {
const PostAsset = new warehouse.Schema({
_id: {type: String, required: true},
slug: {type: String, required: true},
modified: {type: Boolean, default: true},
post: {type: warehouse.Schema.Types.CUID, ref: 'Post'},
renderable: {type: Boolean, default: true}
_id: { type: String, required: true },
slug: { type: String, required: true },
modified: { type: Boolean, default: true },
post: { type: warehouse.Schema.Types.CUID, ref: 'Post' },
renderable: { type: Boolean, default: true }
});

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

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

PostAsset.virtual('source').get(function() {
Expand Down

0 comments on commit b804934

Please sign in to comment.