This is a blog site that I created using Next.js that leverages getStaticProps
for static generation
and Markdown files for content management.
- Clone the repository:
git clone https://github.com/Animesh-Pattnaik/static-blog-app.git
- cd blog-site
- Run the development server:
npm run dev
# or
yarn dev
- Open http://localhost:3000 with your browser to see the result.
content/posts
: Directory containing Markdown files for blog posts.components
: Directory containing reusable components (Layout.js, BlogList.js, BlogPost.js, SearchBar.js).pages
: Next.js pages (index.js for homepage, [slug].js for individual blog posts).styles
: Global CSS for styling.
layout.js
: Layout component for consistent page structure.BlogList.js
: Component to display a list of blog post summaries.BlogPost.js
: Component to display individual blog post content.SearchBar.js
: Component to handle search functionality.
getStaticProps
: Fetches blog posts from Markdown files at build time.getStaticPaths
: Generates paths for individual blog posts based on filenames.
Deploy the project on platforms like Vercel or Netlify.
On Vercel:
- Push your code to a GitHub repository.
- Log in to Vercel and create a new project.
- Import your GitHub repository.
- Follow the prompts to deploy your site.
You now have a blog site with search functionality, enabling users to filter blog posts by their search terms.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!