mirror of
https://github.com/pheralb/svgl.git
synced 2024-11-15 01:31:57 +08:00
⚙️ Activate `prerender
to
/directory
` routes
This commit is contained in:
parent
f76b2a9a86
commit
863df46ff9
@ -4,6 +4,8 @@ import type { PageLoad } from './$types';
|
|||||||
import { svgs } from '@/data/svgs';
|
import { svgs } from '@/data/svgs';
|
||||||
import type { iSVG } from '@/types/svg';
|
import type { iSVG } from '@/types/svg';
|
||||||
|
|
||||||
|
export const prerender = true;
|
||||||
|
|
||||||
export const load = (async ({ params }) => {
|
export const load = (async ({ params }) => {
|
||||||
const { slug } = params;
|
const { slug } = params;
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ export const load = (async ({ params }) => {
|
|||||||
// Filter out the svg with the matching slug:
|
// Filter out the svg with the matching slug:
|
||||||
const svgsByCategory = svgs.filter((svg: iSVG) => {
|
const svgsByCategory = svgs.filter((svg: iSVG) => {
|
||||||
if (Array.isArray(svg.category)) {
|
if (Array.isArray(svg.category)) {
|
||||||
return svg.category.some(categoryItem => categoryItem.toLowerCase() === slug);
|
return svg.category.some((categoryItem) => categoryItem.toLowerCase() === slug);
|
||||||
} else {
|
} else {
|
||||||
return svg.category.toLowerCase() === slug;
|
return svg.category.toLowerCase() === slug;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user