fleet/website/api/controllers/articles/view-basic-whitepaper.js
Eric 46bc7dc880
Website: add whitepaper article template page (#41405)
Changes:
- Updated `build-static-content` to support a new article category:
`whitepaper`
- Added a new article template page: `basic-whitepaper.ejs`.
- Added `deliver-whitepaper-download-request`, an action that
creates/updates a contact and account in the CRM and creates a
historical event when a user submits a form to download a whitepaper.
- Updated the "News" link in the website's header navigation to be
"Resources / Blog", and changed the link to /articles
- Added a link to the whitepapers category page (/whitepapers) to the
side bar navigation on article category pages
- Added a whitepaper article: "Modern endpoint management: Managing
devices as code"
2026-03-11 12:37:23 -05:00

69 lines
1.3 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View basic whitepaper',
description: 'Display "Basic whitepaper" page.',
inputs: {
slug: {
type: 'string',
description: 'The slug of the whitepaper article that will be displayed to the user',
required: true,
}
},
exits: {
success: {
viewTemplatePath: 'pages/articles/basic-whitepaper'
},
badConfig: {
responseType: 'badConfig'
},
notFound: {
responseType: 'notFound'
},
},
fn: async function ({slug}) {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.markdownPages) || !sails.config.builtStaticContent.markdownPages) {
throw {badConfig: 'builtStaticContent.markdownPages'};
}
let thisPage = _.find(sails.config.builtStaticContent.markdownPages, { url: '/whitepapers/'+encodeURIComponent(slug) });
if (!thisPage) {
throw 'notFound';
}
let pageTitleForMeta;
let pageDescriptionForMeta;
if(thisPage.meta.articleTitle) {
pageTitleForMeta = thisPage.meta.articleTitle;
}
if(thisPage.meta.description) {
pageDescriptionForMeta = thisPage.meta.description;
}
// Respond with view.
return {
pageTitleForMeta,
pageDescriptionForMeta,
path: require('path'),
thisPage: thisPage,
};
}
};