lestoitsduval/themes/hugo-theme-directus-import/import.js

24 lines
655 B
JavaScript

const DirectusHugoDriver = require('.');
const driverOptions = {
url: process.env.DIRECTUS_URL,
email: process.env.DIRECTUS_EMAIL,
password: process.env.DIRECTUS_PASSWORD,
buildDrafts: false,
collections: {
'lestoitsduval_actualites': {
pathBuilder: (path, article, urlslug) => {
if (article.slug) {
return `${path}/actualites/${article.slug}`
}
return `${path}/actualites/${article.date}-${urlslug(article.title, { remove: /\./g })}`;
}
}
},
content: {
path: './content'
}
}
const driver = new DirectusHugoDriver(driverOptions);
driver.import()