Dynamic sitemap generation :)
This commit is contained in:
@@ -15,6 +15,11 @@ export default defineNuxtConfig({
|
||||
description: 'BuildPath: a tool for League of Legends champions runes and build paths.',
|
||||
defaultLocale: 'en', // not needed if you have @nuxtjs/i18n installed
|
||||
},
|
||||
sitemap: {
|
||||
sources: [
|
||||
'/api/routemap'
|
||||
]
|
||||
},
|
||||
|
||||
app: {
|
||||
head: {
|
||||
|
||||
17
frontend/server/api/routemap.ts
Normal file
17
frontend/server/api/routemap.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { CDRAGON_BASE } from "~/utils/cdragon";
|
||||
|
||||
async function championRoutes() {
|
||||
const championsData : Array<Champion> = await
|
||||
(await fetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champion-summary.json")).json()
|
||||
|
||||
let routes : Array<string> = []
|
||||
for(let champion of championsData) {
|
||||
routes.push("/champion/" + champion.alias.toLowerCase())
|
||||
}
|
||||
return routes
|
||||
}
|
||||
|
||||
export default defineEventHandler(async (_) => {
|
||||
const data = await championRoutes();
|
||||
return data
|
||||
})
|
||||
Reference in New Issue
Block a user