diff --git a/src/valueObjects/Collection.js b/src/valueObjects/Collection.js index 58950a82..39f71025 100644 --- a/src/valueObjects/Collection.js +++ b/src/valueObjects/Collection.js @@ -9,26 +9,6 @@ function formatToExtension(format) { }[format]; } -function slugFormatter(template, entryData) { - const date = new Date(); - const entry = (typeof entryData === 'string') ? entryData : entryData.get('title', entryData.get('path')); - const identifier = entry.match(/([^:\\/]*?)(?:\.([^ :\\/.]*))?$/)[1]; - return template.replace(/\{\{([^\}]+)\}\}/g, (_, name) => { - switch (name) { - case 'year': - return date.getFullYear(); - case 'month': - return (`0${ date.getMonth() + 1 }`).slice(-2); - case 'day': - return (`0${ date.getDate() }`).slice(-2); - case 'slug': - return identifier.trim().toLowerCase().replace(/[^a-z0-9\.\-_]+/gi, '-'); - default: - return identifier.trim().toLowerCase().replace(/[^a-z0-9\.\-_]+/gi, '-'); - } - }); -} - class FolderCollection { constructor(collection) { this.collection = collection; @@ -43,7 +23,7 @@ class FolderCollection { } entrySlug(path) { - return slugFormatter(this.collection.get('slug'), path); + return path.split('/').pop().replace(/\.[^\.]+$/, ''); } listMethod() {