Skip to content

Commit

Permalink
fix: slug options to defaultLinkset.slug, correct date jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Jan 19, 2024
1 parent 96a1bc3 commit 4b60c50
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const dupeHandlers = {
* @property {boolean} [lower=true] convert to lower case, defaults to `true`
* @property {boolean} [strict=false] strip special characters except replacement, defaults to `false`
* @property {string} [locale] language code of the locale to use
* @property {boolean} trim trim leading and trailing replacement chars, defaults to `true`
* @property {boolean} [trim=true] trim leading and trailing replacement chars, defaults to `true`
*/

/**
Expand All @@ -57,15 +57,15 @@ const dupeHandlers = {
* will be used to match files when at least one `key:value` pair matches, and transform their permalinks according to the rules in this linkset.
* @property {string} pattern A permalink pattern to transform file paths into, e.g. `blog/:date/:title`
* @property {SlugifyOptions|slugFunction} [slug] [Slugify options](https://github.com/simov/slugify) or a custom slug function of the form `(pathpart) => string`
* @property {string} [date='YYYY/MM/DD'] [Moment.js format string](https://momentjs.com/docs/#/displaying/format/) to transform Date link parts into, defaults to `YYYY/MM/DD`.
* @property {string} [date='YYYY/MM/DD'] [Date format string](https://github.com/metalsmith/permalinks/#date-formatting) to transform Date link parts into, defaults to `YYYY/MM/DD`.
*/

/**
* `@metalsmith/permalinks` options & default linkset
*
* @typedef {Object} Options
* @property {string} [pattern=':dirname?/:basename'] A permalink pattern to transform file paths into, e.g. `blog/:date/:title`. Default is `:dirname?/:basename`.
* @property {string} [date='YYYY/MM/DD'] [Moment.js format string](https://momentjs.com/docs/#/displaying/format/) to transform Date link parts into, defaults to `YYYY/MM/DD`.
* @property {string} [date='YYYY/MM/DD'] [Date format string](https://github.com/metalsmith/permalinks/#date-formatting) to transform Date link parts into, defaults to `YYYY/MM/DD`.
* @property {string} [directoryIndex='index.html'] Basename of the permalinked file (default: `index.html`)
* @property {boolean} [trailingSlash=false] Whether a trailing `/` should be added to the `file.permalink` property. Useful to avoid redirects on servers which do not have a built-in rewrite module enabled.
* @property {'error'|'index'|'overwrite'|Function} [duplicates='error'] How to handle duplicate target URI's.
Expand Down Expand Up @@ -118,8 +118,8 @@ const defaultOptions = {
*
* @return {String}
*/
function slugFn(options = defaultOptions.slug) {
options = Object.assign({}, defaultOptions.slug, options)
function slugFn(options = defaultLinkset.slug) {
options = Object.assign({}, defaultLinkset.slug, options)
if (typeof options.extend === 'object' && options.extend !== null) {
slugify.extend(options.extend)
}
Expand Down

0 comments on commit 4b60c50

Please sign in to comment.