Skip to content

Commit

Permalink
fix(post-asset): strip extensions better on permalink (#5153)
Browse files Browse the repository at this point in the history
* compatible with hexo-abbrlink

* strip extensions better on permalink
  • Loading branch information
syunaht authored May 1, 2023
1 parent 7edbf25 commit 8b95bbc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/models/post_asset.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const { Schema } = require('warehouse').default;
const { join } = require('path');
const { join, dirname } = require('path');

module.exports = ctx => {
const PostAsset = new Schema({
Expand All @@ -19,8 +19,8 @@ module.exports = 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 8b95bbc

Please sign in to comment.