mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Pull title and description from tvEntry
This commit is contained in:
parent
3b36f4f26c
commit
b2c9774ca8
1 changed files with 28 additions and 19 deletions
|
|
@ -3,13 +3,15 @@ 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, getRouteType } from '../helpers/app-derived'
|
import { getRouteType } from '../helpers/app-derived'
|
||||||
|
|
||||||
// Setup dotenv
|
// Setup dotenv
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
export const makeTitle = function ( tvEntry ) {
|
export const makeTitle = function ( name ) {
|
||||||
return `${ tvEntry.name } - ${ config.head.title }`
|
// console.log('tvEntry', tvEntry)
|
||||||
|
|
||||||
|
return `${ name } - ${ config.head.title }`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeDescription = function ( tvEntry ) {
|
export const makeDescription = function ( tvEntry ) {
|
||||||
|
|
@ -31,32 +33,42 @@ class TV {
|
||||||
|
|
||||||
pagination: {
|
pagination: {
|
||||||
data: 'eleventy-endpoints',
|
data: 'eleventy-endpoints',
|
||||||
|
// data: 'collections.tv',
|
||||||
size: 1,
|
size: 1,
|
||||||
alias: 'tvEntry',
|
alias: 'tvEntry',
|
||||||
before: function( data ) {
|
before: function( endpoint ) {
|
||||||
return data.filter( entry => {
|
// console.log('Before runs')
|
||||||
|
|
||||||
|
return endpoint.filter( entry => {
|
||||||
const routeType = getRouteType( entry.route )
|
const routeType = getRouteType( entry.route )
|
||||||
|
|
||||||
return routeType === 'tv'
|
return routeType === 'tv'
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// tags: [ 'tv' ],
|
||||||
|
|
||||||
eleventyComputed: {
|
eleventyComputed: {
|
||||||
title: ( { tvEntry } ) => {
|
title: data => {
|
||||||
// console.log('data', data)
|
// Declare dependencies for Eleventy
|
||||||
return makeTitle( tvEntry )
|
// https://www.11ty.dev/docs/data-computed/#declaring-your-dependencies
|
||||||
|
data.tvEntry
|
||||||
|
|
||||||
|
return makeTitle( data.tvEntry.payload.video.name )
|
||||||
},
|
},
|
||||||
description: ( { tvEntry } ) => {
|
description: ( data ) => {
|
||||||
return makeDescription( tvEntry )
|
// Declare dependencies for Eleventy
|
||||||
|
// https://www.11ty.dev/docs/data-computed/#declaring-your-dependencies
|
||||||
|
data.tvEntry
|
||||||
|
|
||||||
|
return makeDescription( data.tvEntry )
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
permalink: ( { tvEntry: { route } } ) => {
|
permalink: ( data ) => {
|
||||||
// console.log('data', data)
|
|
||||||
// return `tv/${ video.slug }/`
|
|
||||||
|
|
||||||
return route.substring(1) + '/'
|
return data.tvEntry.route.substring(1) + '/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -71,13 +83,10 @@ class TV {
|
||||||
relatedVideos = []
|
relatedVideos = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// tvEntry: {
|
|
||||||
// video,
|
|
||||||
// relatedVideos = []
|
|
||||||
// },
|
|
||||||
// 'device-list': deviceList
|
// 'device-list': deviceList
|
||||||
} = data
|
} = data
|
||||||
|
|
||||||
|
|
||||||
// console.log('video.payload', Object.keys(video.payload))
|
// console.log('video.payload', Object.keys(video.payload))
|
||||||
|
|
||||||
const rowHtml = await this.boundComponent(VideoRow)( relatedVideos )
|
const rowHtml = await this.boundComponent(VideoRow)( relatedVideos )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue