Add support for video data from eleventy-endpoints

This commit is contained in:
Sam Carlton 2021-03-02 22:28:52 -06:00
parent ef4f3d570e
commit 350a6e1a95
2 changed files with 13 additions and 7 deletions

View file

@ -226,7 +226,7 @@ class BuildLists {
if ( isVideo ) { if ( isVideo ) {
// this.endpointSets.eleventy.add({ // this.endpointSets.eleventy.add({
// route: getVideoEndpoint(app), // route: getVideoEndpoint(app),
// // payload: buildVideoPayload( app, this.allVideoAppsList, this.lists.video ) // payload: buildVideoPayload( app, this.allVideoAppsList, this.lists.video )
// }) // })
this.endpointSets.nuxt.add({ this.endpointSets.nuxt.add({

View file

@ -3,6 +3,7 @@ import dotenv from 'dotenv'
import config from '../nuxt.config' import config from '../nuxt.config'
import VideoRow from '../components-eleventy/video/row.js' import VideoRow from '../components-eleventy/video/row.js'
import { isVideo } from '../helpers/app-derived'
// Setup dotenv // Setup dotenv
dotenv.config() dotenv.config()
@ -29,29 +30,34 @@ class TV {
layout: 'default.11ty.js', layout: 'default.11ty.js',
pagination: { pagination: {
data: 'video-list', data: 'eleventy-endpoints',
size: 1, size: 1,
alias: 'video' alias: 'payload',
before: function( data ) {
return data.filter( entry => {
return entry.payload.hasOwnProperty('video') && isVideo( entry.payload.video )
})
}
}, },
eleventyComputed: { eleventyComputed: {
title: ({ video }) => { title: ({ payload: { video } }) => {
// console.log('data', data) // console.log('data', data)
return makeTitle( video ) return makeTitle( video )
}, },
description: ({ video }) => { description: ({ payload: { video } }) => {
return makeDescription( video ) return makeDescription( video )
}, },
}, },
permalink: ({ video }) => { permalink: ({ payload: { video } }) => {
// console.log('data', data) // console.log('data', data)
return `tv/${ video.slug }/` return `tv/${ video.slug }/`
} }
} }
} }
render({ video }) { render({ payload: { video } }) {
// console.log('video.payload', Object.keys(video.payload)) // console.log('video.payload', Object.keys(video.payload))