Skip to content

Commit 9fb74b3

Browse files
stable release
1 parent 0f97998 commit 9fb74b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2338
-100
lines changed

README.md

+2-34
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,2 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2-
3-
## Getting Started
4-
5-
First, run the development server:
6-
7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
```
12-
13-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14-
15-
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16-
17-
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18-
19-
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20-
21-
## Learn More
22-
23-
To learn more about Next.js, take a look at the following resources:
24-
25-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27-
28-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29-
30-
## Deploy on Vercel
31-
32-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33-
34-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
1+
Build static website with markdown and nextjs.
2+
In nextjs we provide sitemap, SEO and Search support.

components/Banner.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default function Banner() {
2+
return(
3+
<header className="py-5 bg-light border-bottom mb-4">
4+
<div className="container">
5+
<div className="text-center my-5">
6+
<h1 className="fw-bolder">Welcome to my blog home page </h1>
7+
<p className="lead mb-0">Build nextjs blog website with Markdown, sitemap, serachbar, category, tag and SEO support </p>
8+
</div>
9+
</div>
10+
</header>
11+
)
12+
}

components/Footer.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default function Footer() {
2+
return <footer className="py-5 bg-dark">
3+
<div className="container"><p className="m-0 text-center text-white">Copyright &copy; Your Website 2022</p></div>
4+
</footer>
5+
}

components/Header.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import Link from 'next/link'
2+
export default function Header() {
3+
return (<>
4+
5+
<nav className="navbar navbar-expand-lg navbar-dark bg-dark">
6+
<div className="container">
7+
<Link href="/">
8+
<a className='navbar-brand'>
9+
Markdown + Nextjs
10+
</a>
11+
</Link>
12+
13+
<button className="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span className="navbar-toggler-icon"></span></button>
14+
<div className="collapse navbar-collapse" id="navbarSupportedContent">
15+
<ul className="navbar-nav ms-auto mb-2 mb-lg-0">
16+
<Link href="/">
17+
<a className='nav-link'>
18+
<li className="nav-item"> Home </li>
19+
</a>
20+
</Link>
21+
<Link href="/">
22+
<a className='nav-link'>
23+
<li className="nav-item">About </li>
24+
</a>
25+
</Link>
26+
</ul>
27+
</div>
28+
</div>
29+
</nav>
30+
</>
31+
)
32+
}

components/ItemPost.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Link from 'next/link'
2+
3+
import { ImageUrl } from "../utils";
4+
5+
export default function ItemPost({ post: {post } }) {
6+
7+
// const imageUrl= process.env.SITE_URL + post.images[0]
8+
9+
10+
// console.log(imageUrl,' imageUrl ')
11+
12+
const date = new Date(post.date)
13+
14+
return (
15+
<div className="card mb-4">
16+
<a href={`/blog/${post.slug}`} > <img className="card-img-top" src={ ImageUrl(post.images[0])} alt={post.title} /></a>
17+
<div className="card-body">
18+
<div className="small text-muted">{`${date.getMonth() + 1} - ${date.getDate()} - ${date.getFullYear()}`}</div>
19+
<h2 className="card-title">{post.title}</h2>
20+
<p className="card-text">{post.summary}</p>
21+
<Link href={`/blog/${post.slug}`}>
22+
<a className='btn'>Read More</a>
23+
</Link>
24+
</div>
25+
</div>
26+
27+
28+
)
29+
}

components/Post.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import Link from 'next/link'
2+
import { slugify } from '../utils'
3+
4+
export default function Post({ post }) {
5+
6+
const date = new Date(post.frontmatter.date)
7+
return (
8+
<div className="card mb-4">
9+
<a href={`/blog/${post.slug}`} > <img className="card-img-top" src={post.frontmatter.image} alt="..." /></a>
10+
<div className="card-body">
11+
<div className="small text-muted">{`${date.getMonth() + 1} - ${date.getDate()} - ${date.getFullYear()}`}</div>
12+
13+
<div> {
14+
post.frontmatter.tags.map(
15+
tag => {
16+
17+
const slug = slugify(tag)
18+
19+
return (<Link key={tag} href={`/tag/${slug}`}>
20+
<a className='btn'>
21+
<h6 className=' post-title'>#{tag}</h6>
22+
</a>
23+
</Link>)
24+
}
25+
)
26+
} </div>
27+
<h2 className="card-title">{post.frontmatter.title}</h2>
28+
<p className="card-text">{post.frontmatter.summary}</p>
29+
<Link href={`/blog/${post.slug}`}>
30+
<a className='btn'>Read More</a>
31+
</Link>
32+
</div>
33+
</div>
34+
)
35+
}

components/Sidebar.js

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { useState} from "react";
2+
import Link from 'next/link'
3+
import Search from "../search.json";
4+
import { slugify } from "../utils";
5+
6+
export default function Sidebar() {
7+
const [search, setSearch]= useState()
8+
function findSerach(value) {
9+
10+
setSearch(value.target.value)
11+
}
12+
13+
return (
14+
<div className="col-lg-4">
15+
16+
<div className="card mb-4">
17+
<div className="card-header">Search</div>
18+
<div className="card-body">
19+
<div className="input-group">
20+
<input onChange={findSerach} className="form-control" type="text" placeholder="Enter search term..." aria-label="Enter search term..." aria-describedby="button-search" />
21+
<Link href={{ pathname: '/Search', query: { q: search?.toLowerCase() } }}>
22+
<a className="btn btn-primary" id="button-search">Go!</a>
23+
</Link>
24+
</div>
25+
</div>
26+
</div>
27+
28+
<div className="card mb-4">
29+
<div className="card-header">Categories</div>
30+
<div className="card-body">
31+
<div className="row">
32+
<div className="col-sm-10">
33+
<ul className="list-unstyled mb-0">
34+
35+
{
36+
Search?.map(
37+
post => {
38+
return post.frontmatter.categories.map(
39+
item => {
40+
const slug = slugify(item)
41+
42+
return <Link key={item} href={`/category/${slug}`}>
43+
<a> <li> {item} </li></a>
44+
</Link>
45+
}
46+
)
47+
48+
}
49+
)
50+
}
51+
</ul>
52+
</div>
53+
54+
</div>
55+
</div>
56+
</div>
57+
58+
<div className="card mb-4">
59+
<div className="card-header">Side Widget</div>
60+
<div className="card-body">You can put anything you want inside of these side widgets. They are easy to use, and feature the Bootstrap 5 card component!</div>
61+
</div>
62+
</div>
63+
)
64+
}

config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const SITE_URL= 'http://localhost:3000/'
2+
3+
export default SITE_URL

next-seo.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default {
2+
openGraph: {
3+
type: 'website',
4+
locale: 'en_IE',
5+
url: 'https://markdownnextjs.com',
6+
site_name: 'Rajdeep Singh',
7+
},
8+
twitter: {
9+
handle: '@Official_R_deep',
10+
site: '@Official_R_deep',
11+
cardType: 'summary_large_image',
12+
}
13+
};

next-sitemap.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** @type {import('next-sitemap').IConfig} */
2+
3+
module.exports = {
4+
siteUrl: process.env.SITE_URL || 'https://example.com',
5+
generateRobotsTxt: true, // (optional)
6+
// Default transformation function
7+
}

0 commit comments

Comments
 (0)