mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Fix eleventy route collisions
This commit is contained in:
parent
01da7a3cad
commit
bf0d665866
4 changed files with 18 additions and 8 deletions
|
|
@ -9,7 +9,13 @@ import buildVideoList from './helpers/build-video-list.js'
|
|||
import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js'
|
||||
|
||||
import { categories, getAppCategory } from './helpers/categories.js'
|
||||
import { hasStory, getAppType, getAppEndpoint, getVideoEndpoint } from './helpers/app-derived.js'
|
||||
import {
|
||||
hasStory,
|
||||
getAppType,
|
||||
getAppEndpoint,
|
||||
getStoryEndpoint,
|
||||
getVideoEndpoint
|
||||
} from './helpers/app-derived.js'
|
||||
import { makeSearchableList } from './helpers/searchable-list.js'
|
||||
|
||||
// Setup dotenv
|
||||
|
|
@ -240,7 +246,7 @@ class BuildLists {
|
|||
if ( hasStory( app ) ) {
|
||||
const payload = buildAppBenchmarkPayload( app, this.allVideoAppsList, this.lists.video )
|
||||
|
||||
this.endpointMaps.eleventy.set( `${getAppEndpoint(app)}/story/`, payload )
|
||||
this.endpointMaps.eleventy.set( getStoryEndpoint(app), payload )
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ export function getAppEndpoint ( app ) {
|
|||
return `/${appType}/${app.slug}`
|
||||
}
|
||||
|
||||
export function getStoryEndpoint( app ) {
|
||||
return `${getAppEndpoint(app)}/story/`
|
||||
}
|
||||
|
||||
export function getVideoEndpoint ( video ) {
|
||||
|
||||
return `/tv/${video.slug}`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import dotenv from 'dotenv'
|
|||
|
||||
import config from '../nuxt.config.js'
|
||||
|
||||
import { getAppType } from '../helpers/app-derived.js'
|
||||
import { getAppType, getAppEndpoint } from '../helpers/app-derived.js'
|
||||
import { makeLastUpdatedFriendly } from '../helpers/parse-date'
|
||||
|
||||
|
||||
|
|
@ -35,10 +35,10 @@ export class AppTemplate {
|
|||
alias: 'app',
|
||||
|
||||
before: function( data ) {
|
||||
return data.filter( entry => {
|
||||
const appType = getAppType( entry.payload.app )
|
||||
return data.filter( endpoint => {
|
||||
const appType = getAppType( endpoint.payload.app )
|
||||
|
||||
return appType === 'app'
|
||||
return appType === 'app' && endpoint.route === getAppEndpoint( endpoint.payload.app )
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import dotenv from 'dotenv'
|
|||
|
||||
import config from '../nuxt.config.js'
|
||||
|
||||
import { hasStory } from '../helpers/app-derived.js'
|
||||
import { hasStory, getStoryEndpoint } from '../helpers/app-derived.js'
|
||||
import { makeLastUpdatedFriendly } from '../helpers/parse-date'
|
||||
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ export class Story {
|
|||
return data.filter( entry => {
|
||||
// const appType = getAppType( entry.payload.app )
|
||||
|
||||
return hasStory ( entry.payload.app )
|
||||
return hasStory ( entry.payload.app ) && entry.route === getStoryEndpoint( entry.payload.app )
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue