diff --git a/lib/models/post.js b/lib/models/post.js index 31c03eeebc..07367c156c 100644 --- a/lib/models/post.js +++ b/lib/models/post.js @@ -54,8 +54,8 @@ module.exports = ctx => { Post.virtual('permalink').get(function() { const { config } = ctx; let partial_url = url_for.call(ctx, this.path); - if (config.relative_link) partial_url = `/${partial_url}`; if (config.pretty_urls.trailing_index === false) partial_url = partial_url.replace(/index\.html$/, ''); + if (config.relative_link) partial_url = `/${partial_url}`; return full_url_for.call(ctx, partial_url.replace(config.root, '/')); });