in lib/rssfeed.js [22:62]
module.exports.register = function ( { config }) {
this.on('beforePublish', ({ siteCatalog, contentCatalog, playbook}) => {
// filter page to have blogentry
const pages = contentCatalog.getPages(({ asciidoc, out }) => {
if (! out || ! asciidoc)
return
const pageTags = asciidoc.attributes['page-tags']
const rvalue = pageTags && pageTags.split(', ').includes('blogentry')
return rvalue
})
const { buildPageUiModel } = require.main.require('@antora/page-composer/build-ui-model')
// put every information on page
const blogpages = pages.map((page) => buildPageUiModel(siteCatalog, page, contentCatalog)).sort(sortByDate)
// bulild xml as string
var feed = '<?xml version="1.0" encoding="UTF-8"?>'
feed += '\n<feed xmlns="http://www.w3.org/2005/Atom">'
feed += '\n <title type="html">Apache NetBeans</title>'
feed += '\n <subtitle type="html">Quickly and easily develop web, mobile and desktop applications with Java, JavaScript, HTML5, PHP, C/C++ and more. </subtitle>'
feed += '\n <icon>https://netbeans.apache.org/favicon-32x32.png</icon>'
feed += '\n <id>https://netbeans.apache.org/blogs/atom</id>'
feed += '\n <link rel="self" type="application/atom+xml" href="https://netbeans.apache.org/front/main/blogs/atom" />'
feed += '\n <link rel="alternate" type="text/html" href="https://netbeans.apache.org/blogs/atom" />'
blogpages.forEach((p) => {
feed += '\n <entry>'
feed += '\n <id>' + playbook.site.url + p.url + '</id>'
feed += '\n <title type="html">' + escape(p.title.toString()) + '</title>'
feed += '\n <author><name>' + p.author + '</name></author>'
feed += '\n <link rel="alternate" type="text/html" href="' + playbook.site.url + p.url + '"/>'
feed += '\n <published>' + rssDate(p.attributes.revdate) + '</published>'
feed += '\n <updated>' + rssDate(p.attributes.revdate) + '</updated>'
feed += '\n <content type="html">'
feed += '\n'+ escape(blogcontent(p.contents.toString()))
feed += '\n </content>'
feed += '\n </entry>'
})
feed += '\n</feed>'
// transfer to file in folder hierarchy
const contents = Buffer.from(feed)
siteCatalog.addFile({ contents, out: { path: 'front/main/blogs/atom' } })
})
}