fleet/website/api/controllers/landing-pages/view-basic-comparison.js
Eric b52b067ea2
Website: follow-up changes from website review session (#39200)
Changes:
- Updated the category for comparison articles (`compare` »
`comparison`)
- Updated article meta tag validation and how URLS of comparison
articles are built
- Updated the view action for comparison articles to set a meta title
and description
2026-02-02 17:46:35 -06:00

66 lines
1.3 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View basic comparison',
description: 'Display "Basic comparison" page.',
inputs: {
slug: {
type: 'string',
description: 'The slug of the comparison page that will be displayed to the user',
required: true,
}
},
exits: {
success: {
viewTemplatePath: 'pages/landing-pages/basic-comparison'
},
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: '/compare/'+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,
};
}
};