Fix eleventy route collisions

This commit is contained in:
Sam Carlton 2021-03-13 21:40:02 -06:00
parent 01da7a3cad
commit bf0d665866
4 changed files with 18 additions and 8 deletions

View file

@ -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 )
})
}
},

View file

@ -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 )
})
}
},