diff --git a/pages-eleventy/formula.11ty.js b/pages-eleventy/formula.11ty.js new file mode 100644 index 0000000..526197f --- /dev/null +++ b/pages-eleventy/formula.11ty.js @@ -0,0 +1,97 @@ +import dotenv from 'dotenv' + +import config from '../nuxt.config.js' + +import { getAppType } from '../helpers/app-derived.js' + +// import VideoRow from '../components-eleventy/video/row.js' +// import { isVideo } from '../helpers/app-derived' + +// Setup dotenv +dotenv.config() + +export const makeTitle = function ( app ) { + return `Does ${app.name} work on Apple Silicon? - ${ config.head.title }` +} + +export const makeDescription = function ( app ) { + return `Latest reported support status of ${ app.name } on Apple Silicon and Apple M1 Processors when installed via Homebrew. ` +} + +class FormulaTemplate { + // or `async data() {` + // or `get data() {` + data () { + return { + layout: 'default.11ty.js', + + pagination: { + data: 'eleventy-endpoints', + size: 1, + alias: 'formula', + before: function( data ) { + return data.filter( entry => { + const appType = getAppType( entry.payload.app ) + + return appType === 'formula' + }) + } + }, + + eleventyComputed: { + title: ({ formula: { payload: { app } } }) => { + // console.log('data', data) + return makeTitle( app ) + }, + description: ({ formula: { payload: { app } } }) => { + return makeDescription( app ) + }, + }, + + permalink: ({ formula }) => { + // console.log('payload', formula.payload) + return formula.route.substring(1) + '/' + } + } + } + + render({ formula: { payload: { app } } }) { + + // console.log('video.payload', Object.keys(video.payload)) + + const relatedLinksHtml = app.relatedLinks.map( (link, i) => { + return /* html */` + ${ (i === 0) ? 'View' : link.label } + ` + } ).join('') + + return /* html */` + + + + Does ${ app.name } work on Apple Silicon when installed via Homebrew? + + + ${ app.text } + + + + ${ app.content } + + + + ${ relatedLinksHtml } + + + + ` + } +} + +module.exports = FormulaTemplate
${ app.name }