akashacms-blog-podcast
Advanced tools
Comparing version 0.7.4 to 0.7.5
188
index.js
@@ -65,2 +65,3 @@ /** | ||
async onSiteRendered(config) { | ||
const plugin = this; | ||
const tasks = []; | ||
@@ -77,3 +78,3 @@ for (var blogkey in this.options.bloglist) { | ||
const taskStart = new Date(); | ||
var documents = await findBlogDocs(config, undefined, blogcfg); | ||
var documents = await plugin.findBlogDocs(config, blogcfg); | ||
var count = 0; | ||
@@ -138,2 +139,98 @@ var documents2 = documents.filter(doc => { | ||
} | ||
/** | ||
* | ||
blogPodcast: { | ||
"news": { | ||
rss: { | ||
title: "AkashaCMS News", | ||
description: "Announcements and news about the AkashaCMS content management system", | ||
site_url: "http://akashacms.com/news/index.html", | ||
image_url: "http://akashacms.com/logo.gif", | ||
managingEditor: 'David Herron', | ||
webMaster: 'David Herron', | ||
copyright: '2015 David Herron', | ||
language: 'en', | ||
categories: [ "Node.js", "Content Management System", "HTML5", "Static website generator" ] | ||
}, | ||
rssurl: "/news/rss.xml", | ||
matchers: { | ||
layouts: [ "blog.html.ejs" ], | ||
path: /^news\// | ||
} | ||
}, | ||
"howto": { | ||
rss: { | ||
title: "AkashaCMS Tutorials", | ||
description: "Tutorials about using the AkashaCMS content management system", | ||
site_url: "http://akashacms.com/howto/index.html", | ||
image_url: "http://akashacms.com/logo.gif", | ||
managingEditor: 'David Herron', | ||
webMaster: 'David Herron', | ||
copyright: '2015 David Herron', | ||
language: 'en', | ||
categories: [ "Node.js", "Content Management System", "HTML5", "HTML5", "Static website generator" ] | ||
}, | ||
rssurl: "/howto/rss.xml", | ||
matchers: { | ||
layouts: [ "blog.html.ejs" ], | ||
path: /^howto\// | ||
} | ||
} | ||
}, | ||
* | ||
*/ | ||
async findBlogDocs(config, blogcfg) { | ||
if (!blogcfg || !blogcfg.matchers) { | ||
throw new Error(`findBlogDocs no blogcfg`); | ||
} | ||
var documents = await akasha.documentSearch(config, { | ||
// rootPath: docDirPath, | ||
pathmatch: blogcfg.matchers.path ? blogcfg.matchers.path : undefined, | ||
renderers: [ akasha.HTMLRenderer ], | ||
layouts: blogcfg.matchers.layouts ? blogcfg.matchers.layouts : undefined, | ||
rootPath: blogcfg.rootPath ? blogcfg.rootPath : undefined | ||
}); | ||
// for (let document of documents) { | ||
// console.log(`findBlogDocs blog doc ${document.docpath} ${document.metadata.layout} ${document.metadata.publicationDate}`); | ||
// } | ||
// console.log('findBlogDocs '+ util.inspect(documents)); | ||
documents.sort((a, b) => { | ||
var aPublicationDate = Date.parse( | ||
a.metadata.publicationDate ? a.metadata.publicationDate : a.stat.mtime | ||
); | ||
var bPublicationDate = Date.parse( | ||
b.metadata.publicationDate ? b.metadata.publicationDate : b.stat.mtime | ||
); | ||
if (aPublicationDate < bPublicationDate) return -1; | ||
else if (aPublicationDate === bPublicationDate) return 0; | ||
else return 1; | ||
}); | ||
// for (let document of documents) { | ||
// console.log(`findBlogDocs blog doc sorted ${document.docpath} ${document.metadata.layout} ${document.metadata.publicationDate}`); | ||
// } | ||
documents.reverse(); | ||
// for (let document of documents) { | ||
// console.log(`findBlogDocs blog doc reversed ${document.docpath} ${document.metadata.layout} ${document.metadata.publicationDate}`); | ||
// } | ||
return documents; | ||
} | ||
async findBlogIndexes(config, blogcfg) { | ||
if (!blogcfg.indexmatchers) return []; | ||
return await akasha.documentSearch(config, { | ||
pathmatch: blogcfg.indexmatchers.path ? blogcfg.indexmatchers.path : undefined, | ||
renderers: [ akasha.HTMLRenderer ], | ||
layouts: blogcfg.indexmatchers.layouts ? blogcfg.indexmatchers.layouts : undefined, | ||
rootPath: blogcfg.rootPath ? blogcfg.rootPath : undefined | ||
}); | ||
} | ||
} | ||
@@ -152,86 +249,3 @@ | ||
/** | ||
* | ||
blogPodcast: { | ||
"news": { | ||
rss: { | ||
title: "AkashaCMS News", | ||
description: "Announcements and news about the AkashaCMS content management system", | ||
site_url: "http://akashacms.com/news/index.html", | ||
image_url: "http://akashacms.com/logo.gif", | ||
managingEditor: 'David Herron', | ||
webMaster: 'David Herron', | ||
copyright: '2015 David Herron', | ||
language: 'en', | ||
categories: [ "Node.js", "Content Management System", "HTML5", "Static website generator" ] | ||
}, | ||
rssurl: "/news/rss.xml", | ||
matchers: { | ||
layouts: [ "blog.html.ejs" ], | ||
path: /^news\// | ||
} | ||
}, | ||
"howto": { | ||
rss: { | ||
title: "AkashaCMS Tutorials", | ||
description: "Tutorials about using the AkashaCMS content management system", | ||
site_url: "http://akashacms.com/howto/index.html", | ||
image_url: "http://akashacms.com/logo.gif", | ||
managingEditor: 'David Herron', | ||
webMaster: 'David Herron', | ||
copyright: '2015 David Herron', | ||
language: 'en', | ||
categories: [ "Node.js", "Content Management System", "HTML5", "HTML5", "Static website generator" ] | ||
}, | ||
rssurl: "/howto/rss.xml", | ||
matchers: { | ||
layouts: [ "blog.html.ejs" ], | ||
path: /^howto\// | ||
} | ||
} | ||
}, | ||
* | ||
*/ | ||
var findBlogDocs = async function(config, metadata, blogcfg) { | ||
if (!blogcfg || !blogcfg.matchers) { | ||
throw new Error(`findBlogDocs no blogcfg for ${util.inspect(metadata.document)}`); | ||
} | ||
var documents = await akasha.documentSearch(config, { | ||
// rootPath: docDirPath, | ||
pathmatch: blogcfg.matchers.path ? blogcfg.matchers.path : undefined, | ||
renderers: [ akasha.HTMLRenderer ], | ||
layouts: blogcfg.matchers.layouts ? blogcfg.matchers.layouts : undefined, | ||
rootPath: blogcfg.rootPath ? blogcfg.rootPath : undefined | ||
}); | ||
// console.log('findBlogDocs '+ util.inspect(documents)); | ||
documents.sort((a, b) => { | ||
var aPublicationDate = Date.parse( | ||
a.metadata.publicationDate ? a.metadata.publicationDate : a.stat.mtime | ||
); | ||
var bPublicationDate = Date.parse( | ||
b.metadata.publicationDate ? b.metadata.publicationDate : b.stat.mtime | ||
); | ||
if (aPublicationDate < bPublicationDate) return -1; | ||
else if (aPublicationDate === bPublicationDate) return 0; | ||
else return 1; | ||
}); | ||
documents.reverse(); | ||
return documents; | ||
}; | ||
function findBlogIndexes(config, metadata, blogcfg) { | ||
if (!blogcfg.indexmatchers) return Promise.resolve([]); | ||
return akasha.documentSearch(config, { | ||
pathmatch: blogcfg.indexmatchers.path ? blogcfg.indexmatchers.path : undefined, | ||
renderers: [ akasha.HTMLRenderer ], | ||
layouts: blogcfg.indexmatchers.layouts ? blogcfg.indexmatchers.layouts : undefined, | ||
rootPath: blogcfg.rootPath ? blogcfg.rootPath : undefined | ||
}); | ||
} | ||
class BlogNewsRiverElement extends mahabhuta.CustomElement { | ||
@@ -274,3 +288,3 @@ get elementName() { return "blog-news-river"; } | ||
var documents = await findBlogDocs(this.array.options.config, metadata, _blogcfg); | ||
var documents = await this.array.options.config.plugin(pluginName).findBlogDocs(this.array.options.config, _blogcfg); | ||
@@ -313,3 +327,3 @@ // log('blog-news-river documents '+ util.inspect(documents)); | ||
let indexDocuments = await findBlogIndexes(this.array.options.config, metadata, blogcfg); | ||
let indexDocuments = await this.array.options.config.plugin(pluginName).findBlogIndexes(this.array.options.config, blogcfg); | ||
return akasha.partial(this.array.options.config, template, { indexDocuments }); | ||
@@ -393,3 +407,3 @@ } | ||
let docpathNoSlash = metadata.document.path.startsWith('/') ? metadata.document.path.substring(1) : metadata.document.path; | ||
let documents = await findBlogDocs(this.array.options.config, metadata, blogcfg); | ||
let documents = await this.array.options.config.plugin(pluginName).findBlogDocs(this.array.options.config, blogcfg); | ||
@@ -396,0 +410,0 @@ let docIndex = -1; |
@@ -14,3 +14,6 @@ { | ||
}, | ||
"version": "0.7.4", | ||
"bin": { | ||
"akasharender": "cli.js" | ||
}, | ||
"version": "0.7.5", | ||
"engines": { | ||
@@ -17,0 +20,0 @@ "node": ">=12.2" |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"author": "David Herron <david@davidherron.com>nv", | ||
"author": "David Herron <david@davidherron.com>", | ||
"license": "ISC", | ||
@@ -17,0 +17,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35376
12
412
3