This commit is contained in:
2025-08-18 11:30:28 -05:00
parent 713dbc1430
commit c2b0d905e1
6 changed files with 58 additions and 25 deletions
+17 -9
View File
@@ -127,17 +127,25 @@ const AuthorPage: React.FC<AuthorPageProps> = ({ posts, author }) => {
};
export const getStaticPaths: GetStaticPaths = async () => {
const posts = getSortedPostsData();
const authors = Array.from(new Set(posts.flatMap(post => post.author)));
try {
const posts = getSortedPostsData();
const authors = Array.from(new Set(posts.flatMap(post => post.author)));
const paths = authors.map((author) => ({
params: { author },
}));
const paths = authors.map((author) => ({
params: { author },
}));
return {
paths,
fallback: false,
};
return {
paths,
fallback: 'blocking',
};
} catch (error) {
console.error('Failed to generate author paths during build:', error);
return {
paths: [],
fallback: 'blocking',
};
}
};
export const getStaticProps: GetStaticProps = async ({ params }) => {
+18 -12
View File
@@ -57,21 +57,27 @@ const AuthorsPage: React.FC<AuthorsPageProps> = ({ authors }) => {
};
export const getStaticProps: GetStaticProps = async () => {
const { data: authorsData, error } = await supabase
.from('authors')
.select('name, bio, x_link, fb_link, insta_link, pfp_link');
try {
const { data: authorsData, error } = await supabase
.from('authors')
.select('name, bio, x_link, fb_link, insta_link, pfp_link');
if (error || !authorsData) {
console.error('Error fetching authors:', error);
if (error || !authorsData) {
console.error('Error fetching authors:', error);
// Return empty array for static export fallback
return { props: { authors: [] } };
}
return {
props: {
authors: authorsData,
},
};
} catch (error) {
console.error('Failed to fetch authors during build:', error);
// Fallback for static export when Supabase is not available during build
return { props: { authors: [] } };
}
return {
props: {
authors: authorsData,
},
revalidate: 60,
};
};
export default AuthorsPage;