Skip to content

Commit 08d0597

Browse files
author
Programming-Sai
committed
Preparing code for static hosting
1 parent f457509 commit 08d0597

File tree

18 files changed

+614
-473
lines changed

18 files changed

+614
-473
lines changed

next.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {}
2+
const nextConfig = {
3+
compress: true,
4+
basePath: "/Blog", // Set this to your repository name
5+
assetPrefix: "/Blog/", // Same as basePath, but with a trailing slash
6+
};
37

4-
module.exports = nextConfig
8+
module.exports = nextConfig;

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dependencies": {
1212
"@fortawesome/fontawesome-svg-core": "^6.6.0",
1313
"@fortawesome/free-brands-svg-icons": "^6.6.0",
14+
"@fortawesome/free-regular-svg-icons": "^6.6.0",
1415
"@fortawesome/free-solid-svg-icons": "^6.6.0",
1516
"@fortawesome/react-fontawesome": "^0.2.2",
1617
"@tiptap/extension-blockquote": "^2.9.1",

src/app/category/[category]/layout.js

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,55 @@
1-
import { notFound } from 'next/navigation';
2-
import styles from './category.module.css';
3-
import RecentPosts from '@/components/recentposts/RecentPosts';
4-
import PopularPosts from '@/components/popularposts/PopularPosts';
5-
import Pagination from '@/components/pagination/Pagination';
6-
import Wrapper from '@/components/pagewrapper/Wrapper';
7-
import Navbar from '@/components/navbar/Navbar';
8-
import Footer from '@/components/footer/Footer';
1+
import React from "react"; // Import useEffect for side effects
2+
import { notFound } from "next/navigation";
3+
import styles from "./category.module.css";
4+
import RecentPosts from "@/components/recentposts/RecentPosts";
5+
import PopularPosts from "@/components/popularposts/PopularPosts";
6+
import Pagination from "@/components/pagination/Pagination";
7+
import Wrapper from "@/components/pagewrapper/Wrapper";
8+
import Navbar from "@/components/navbar/Navbar";
9+
import Footer from "@/components/footer/Footer";
910

1011
const validCategories = {
11-
sports: { color: 'green' },
12-
news: { color: 'red' },
13-
lifestyle: { color: 'yellow' },
14-
music: { color: '#CC00FF' },
15-
movies: { color: 'lightblue' },
12+
sports: { color: "green" },
13+
news: { color: "red" },
14+
lifestyle: { color: "yellow" },
15+
music: { color: "#CC00FF" },
16+
movies: { color: "lightblue" },
1617
};
1718

1819
const BlogCategoryLayout = ({ children, params }) => {
1920
const { category } = params;
2021

21-
// Normalize category to lowercase to ensure consistency with validCategories
2222
const normalizedCategory = category.toLowerCase();
2323

24-
// Check if the category is valid
2524
if (!(normalizedCategory in validCategories)) {
26-
return notFound(); // This will render the 404 page
25+
return notFound();
2726
}
2827

2928
return (
3029
<>
3130
<Navbar />
3231
<Wrapper>
3332
<div className={styles.container}>
34-
<h1 className={styles.title} style={{'--bg-color':validCategories[normalizedCategory].color}}>{normalizedCategory.charAt(0).toUpperCase() + normalizedCategory.slice(1)} Related Blogs</h1>
33+
{children}
34+
<h1
35+
className={styles.title}
36+
style={{ "--bg-color": validCategories[normalizedCategory].color }}
37+
>
38+
{normalizedCategory.charAt(0).toUpperCase() +
39+
normalizedCategory.slice(1)}{" "}
40+
Related Blogs
41+
</h1>
3542
<div className={styles.content}>
3643
<div className={styles.blog}>
3744
<RecentPosts className={styles.itemOne} />
38-
<Pagination width={'100%'} className={styles.button} />
45+
<Pagination width={"100%"} className={styles.button} />
3946
</div>
40-
<PopularPosts className={styles.itemTwo} borderRad='20px' marginBlock='5%' isOutline='2px' />
47+
<PopularPosts
48+
className={styles.itemTwo}
49+
borderRad="20px"
50+
marginBlock="5%"
51+
isOutline="2px"
52+
/>
4153
</div>
4254
</div>
4355
</Wrapper>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22

33
const BlogCategoryPage = () => {
4-
return <></>;
4+
return <></>;
55
};
66

77
export default BlogCategoryPage;

0 commit comments

Comments
 (0)