diff --git a/pages-eleventy/app.11ty.js b/pages-eleventy/app.11ty.js new file mode 100644 index 0000000..1896d6a --- /dev/null +++ b/pages-eleventy/app.11ty.js @@ -0,0 +1,124 @@ +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 AppTemplate { + // or `async data() {` + // or `get data() {` + data () { + return { + layout: 'default.11ty.js', + + pagination: { + data: 'eleventy-endpoints', + size: 1, + alias: 'app', + before: function( data ) { + return data.filter( entry => { + const appType = getAppType( entry.payload.app ) + + return appType === 'app' + }) + } + }, + + eleventyComputed: { + title: ({ app: { payload: { app } } }) => { + // console.log('data', data) + return makeTitle( app ) + }, + description: ({ app: { payload: { app } } }) => { + return makeDescription( app ) + }, + }, + + permalink: ({ app }) => { + // console.log('payload', app.payload) + return app.route.substring(1) + '/' + } + } + } + + render({ app: { payload: { app, relatedVideos = [] } } }) { + + // 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? +

+

+ ${ app.text } +

+ + +
+ + + + + +
+ ` + } +} + +module.exports = AppTemplate