diff --git a/astro/src/lib/routing.ts b/astro/src/lib/routing.ts index d350504..64c3b06 100644 --- a/astro/src/lib/routing.ts +++ b/astro/src/lib/routing.ts @@ -11,7 +11,9 @@ export async function getAllRoutesList(settings: GlobalSettings): Promise { - routes.push(webpage.url); + if (webpage.exists) { + routes.push(webpage.url); + } }); if (settings.blog.enabled) { @@ -48,42 +50,45 @@ export async function getAllRoutesList(settings: GlobalSettings): Promise 0) { + const galleries = await getAllAlbums(settings); - categories.forEach((category) => { - let albums = galleries.filter(g => g.category.id === category.id); - const pages = Math.ceil(albums.length / settings.photo.category.perPage); - const categoryRoute = getCategoryRoute(settings.photo, category); + routes.push(settings.photo.categoryIndex.indexRouteTemplate); - for (let i = 0; i < pages; i++) { - if (i !== 0) { - routes.push(`${categoryRoute}/${i + 1}`); + categories.forEach((category) => { + let albums = galleries.filter(g => g.category.id === category.id); + const pages = Math.ceil(albums.length / settings.photo.category.perPage); + const categoryRoute = getCategoryRoute(settings.photo, category); + + for (let i = 0; i < pages; i++) { + if (i !== 0) { + routes.push(`${categoryRoute}/${i + 1}`); + } + else { + routes.push(`${categoryRoute}`); + } } - else { - routes.push(`${categoryRoute}`); - } - } - }); - - galleries.forEach((gallery) => { - const pages = Math.ceil(gallery.photos.length / settings.photo.album.perPage); - const galleryRoute = getAlbumRoute(settings.photo, gallery); - - for (let i = 0; i < pages; i++) { - if (i !== 0) { - routes.push(`${galleryRoute}/${i + 1}`); - } - else { - routes.push(`${galleryRoute}`); - } - } - - gallery.photos.forEach((photo) => { - routes.push(getPhotoRoute(settings.photo, gallery, photo)); }); - }); + + galleries.forEach((gallery) => { + const pages = Math.ceil(gallery.photos.length / settings.photo.album.perPage); + const galleryRoute = getAlbumRoute(settings.photo, gallery); + + for (let i = 0; i < pages; i++) { + if (i !== 0) { + routes.push(`${galleryRoute}/${i + 1}`); + } + else { + routes.push(`${galleryRoute}`); + } + } + + gallery.photos.forEach((photo) => { + routes.push(getPhotoRoute(settings.photo, gallery, photo)); + }); + }); + } } return routes;