UNPKG

storyblok-11ty-data

Version:

Import Stories and Datasources from Storyblok to 11ty as data objects or static files and it adds custom tags for blocks parsing.

12 lines (10 loc) 401 B
class Utils { static slugify(text) { return (text || '').toString().toLowerCase().trim() .replace(/\s+/g, '-') // Replace spaces with - .replace(/&/g, '-and-') // Replace & with 'and' .replace(/[^\w\-]+/g, '') // Remove all non-word chars .replace(/\-\-+/g, '-') // Replace multiple - with single - } } module.exports = Utils