Skip to content

Commit

Permalink
feat: Updated src/pages/[...blog]/index.astro
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Jan 18, 2024
1 parent 7fd2786 commit bfc677f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/pages/[...blog]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { InferGetStaticPropsType, GetStaticPaths } from 'astro';
import merge from 'lodash.merge';
import ApiDataFetcher from '~/components/ApiDataFetcher.astro';
import type { ImageMetadata } from 'astro';
import Layout from '~/layouts/PageLayout.astro';
import SinglePost from '~/components/blog/SinglePost.astro';
Expand All @@ -14,8 +15,22 @@ import type { MetaData } from '~/types';
export const prerender = true;
import type { PropsFromApiDataFetcher } from '~/types/ApiDataFetcher';
export const getStaticPaths = (async () => {
return await getStaticPathsBlogPost();
// Use ApiDataFetcher to get the blog posts or other dynamic content
const apiDataProps = await ApiDataFetcher.getStaticProps();
// Get blog post static paths
const blogPostPaths = await getStaticPathsBlogPost();
// Merge blog post paths with the dynamic content's props
const paths = {
paths: blogPostPaths.paths,
props: { ...apiDataProps.props }
};
return paths;
}) satisfies GetStaticPaths;
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
Expand Down

0 comments on commit bfc677f

Please sign in to comment.