Fix related videos not getting rendered

This commit is contained in:
Sam Carlton 2021-03-15 23:50:52 -05:00
parent 3e6ce6af38
commit f3ac6fd9cb
2 changed files with 21 additions and 12 deletions

View file

@ -6,10 +6,15 @@ import buildGamesList from './helpers/build-game-list.js'
import buildHomebrewList from './helpers/build-homebrew-list.js' import buildHomebrewList from './helpers/build-homebrew-list.js'
import buildVideoList from './helpers/build-video-list.js' import buildVideoList from './helpers/build-video-list.js'
import { videosRelatedToApp } from './helpers/related.js'
import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js' import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js'
import { categories, getAppCategory } from './helpers/categories.js' import { categories, getAppCategory } from './helpers/categories.js'
import { getAppType, getAppEndpoint, getVideoEndpoint } from './helpers/app-derived.js' import {
getAppType,
getAppEndpoint,
getVideoEndpoint,
} from './helpers/app-derived.js'
import { makeSearchableList } from './helpers/searchable-list.js' import { makeSearchableList } from './helpers/searchable-list.js'
// Setup dotenv // Setup dotenv
@ -253,18 +258,23 @@ class BuildLists {
// Add standard app endpoint // Add standard app endpoint
if ( appType === 'app' || appType === 'formula' ) { if ( appType === 'app' || appType === 'formula' ) {
// this.endpointMaps.eleventy.add({
// route: getAppEndpoint(app),
// payload: { app }
// })
this.endpointMaps.eleventy.set( getAppEndpoint(app), { app } ) const relatedVideos = videosRelatedToApp( app, this.lists.video ).map(video => {
// console.log('video', video)
return {
...video,
endpoint: `${getAppEndpoint(app)}/benchmarks#${video.id}`
}
})
// Add app or formula endpoint
this.endpointMaps.eleventy.set( getAppEndpoint(app), {
app,
relatedVideos
} )
} else { } else {
// Add app or game endpoint // Add game or other endpoint
// this.endpointMaps.nuxt.add({
// route: getAppEndpoint(app),
// payload: { app }
// })
// console.log('Added to nuxt endpoints', getAppEndpoint(app)) // console.log('Added to nuxt endpoints', getAppEndpoint(app))
this.endpointMaps.nuxt.set( getAppEndpoint(app), { app } ) this.endpointMaps.nuxt.set( getAppEndpoint(app), { app } )
} }

View file

@ -104,7 +104,6 @@ export class AppTemplate {
${ relatedVideos.length > 0 ? /* html */` ${ relatedVideos.length > 0 ? /* html */`
<div <div
v-if="relatedVideos.length !== 0"
class="related-videos w-full" class="related-videos w-full"
> >
<h2 class="subtitle text-xl md:text-2xl font-bold mb-3"> <h2 class="subtitle text-xl md:text-2xl font-bold mb-3">