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

24 lines
655 B
JavaScript
Raw Normal View History

2021-11-17 22:45:32 +01:00
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()