Skip to content

Commit f9dd22c

Browse files
fixed create-slug hook
1 parent 12ac752 commit f9dd22c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server/hooks/create-slug.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ const slug = require('slug');
33
const getUniqueSlug = require('../helper/get-unique-slug');
44
const _ = require('lodash');
55

6-
module.exports = function (options = { field: null }) {
6+
module.exports = function (options = { field: null, overwrite: false }) {
77
return function (hook) {
88
if(!options.field || !hook.data[options.field]) return hook;
99

1010
// do not overwrite existing slug
11-
// TODO: we should make that possible and relying on ids for routing insead only on slugs
11+
// TODO: we should make that possible and relying on ids for routing instead only on slugs
1212
// the slug should be there for seo reasons but the id should be what counts
13-
if (!_.isEmpty(hook.data.slug) && (!options.overwrite && options.overwrite === false)) return hook;
13+
if (!_.isEmpty(hook.data.slug) && options.overwrite !== false) return hook;
1414

1515
return new Promise(resolve => {
1616

0 commit comments

Comments
 (0)