|
|
@ -10,7 +10,8 @@ import { UserProgressModal } from '../../../components/UserProgress/UserProgress |
|
|
|
import { |
|
|
|
import { |
|
|
|
type BestPracticeFileType, |
|
|
|
type BestPracticeFileType, |
|
|
|
type BestPracticeFrontmatter, |
|
|
|
type BestPracticeFrontmatter, |
|
|
|
} from '../../../lib/best-pratice'; |
|
|
|
getBestPracticeById, |
|
|
|
|
|
|
|
} from '../../../lib/best-practice'; |
|
|
|
import { generateArticleSchema } from '../../../lib/jsonld-schema'; |
|
|
|
import { generateArticleSchema } from '../../../lib/jsonld-schema'; |
|
|
|
|
|
|
|
|
|
|
|
interface Params extends Record<string, string | undefined> { |
|
|
|
interface Params extends Record<string, string | undefined> { |
|
|
@ -22,19 +23,13 @@ interface Props { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { bestPracticeId } = Astro.params as Params; |
|
|
|
const { bestPracticeId } = Astro.params as Params; |
|
|
|
|
|
|
|
const bestPractice = await getBestPracticeById(bestPracticeId).catch( |
|
|
|
let bestPractice; |
|
|
|
() => null, |
|
|
|
try { |
|
|
|
|
|
|
|
bestPractice = await import( |
|
|
|
|
|
|
|
`../../../data/best-practices/${bestPracticeId}/${bestPracticeId}.md` |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (!bestPractice) { |
|
|
|
if (!bestPractice) { |
|
|
|
return Astro.redirect('/404'); |
|
|
|
return Astro.redirect('/404'); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
return Astro.redirect('/404'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const bestPracticeData = bestPractice.frontmatter as BestPracticeFrontmatter; |
|
|
|
const bestPracticeData = bestPractice.frontmatter as BestPracticeFrontmatter; |
|
|
|
|
|
|
|
|
|
|
|