Skip to content

Commit 862322b

Browse files
committed
Merge branch 'console-community-page' of https://github.com/Bhumikagarggg/website into console-community-page
2 parents 19d691e + 1467049 commit 862322b

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

next.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
reactStrictMode: true,
4-
output: 'export',
54
pageExtensions: ['page.tsx'],
65
images: {
76
unoptimized: true,
@@ -44,7 +43,7 @@ const nextConfig = {
4443

4544
fileLoaderRule.exclude = /\.svg$/i;
4645
return config;
47-
},
46+
},
4847
};
4948

5049
module.exports = nextConfig;

pages/blog/index.page.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const getCategories = (frontmatter: any): blogCategories[] => {
3535
return Array.isArray(cat) ? cat : [cat];
3636
};
3737

38-
export async function getStaticProps({ query }: { query: any }) {
38+
export async function getStaticProps() {
3939
const files = fs.readdirSync(PATH);
4040
const blogPosts = files
4141
.filter((file) => file.substr(-3) === '.md')
@@ -54,15 +54,12 @@ export async function getStaticProps({ query }: { query: any }) {
5454
});
5555

5656
await generateRssFeed(blogPosts);
57-
58-
const filterTag: string = query?.type || 'All';
59-
6057
return {
6158
props: {
6259
blogPosts,
63-
filterTag,
6460
},
65-
};
61+
};
62+
6663
}
6764

6865
function isValidCategory(category: any): category is blogCategories {
@@ -86,10 +83,11 @@ export default function StaticMarkdownPage({
8683
}) {
8784
const router = useRouter();
8885
// Initialize the filter as an array. If "All" or not specified, we show all posts.
89-
const initialFilters =
90-
filterTag && filterTag !== 'All'
91-
? filterTag.split(',').filter(isValidCategory)
92-
: ['All'];
86+
const initialFilters = router.query.type
87+
? ((router.query.type as string)
88+
.split(',')
89+
.filter(isValidCategory) as blogCategories[])
90+
: ['All'] as blogCategories[];
9391

9492
const [currentFilterTags, setCurrentFilterTags] =
9593
useState<blogCategories[]>(initialFilters);

0 commit comments

Comments
 (0)