Skip to content

Instantly share code, notes, and snippets.

View officialrajdeepsingh's full-sized avatar
🏠
Working from home

Rajdeep Singh officialrajdeepsingh

🏠
Working from home
View GitHub Profile
// pages/api/auth/[...nextauth].js
import NextAuth from "next-auth"
import GithubProvider from "next-auth/providers/github"
export const authOptions = {
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
import '../styles/globals.css'
import Head from "next/head";
import Header from "../components/Header";
import Footer from "../components/Footer";
import { DefaultSeo } from 'next-seo';
import SEO from '../next-seo.config';
import { SessionProvider } from "next-auth/react"
// for error handing
import ErrorBoundary from '../components/ErrorBoundary';
@officialrajdeepsingh
officialrajdeepsingh / index.html
Created August 17, 2022 10:58
index.html for netlify cms
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Content Manager</title>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
@officialrajdeepsingh
officialrajdeepsingh / config.yml
Created August 17, 2022 09:04
config.yml config file for netlify cms
backend:
name: git-gateway
branch: main
media_folder: "public/images" # Media files will be stored in the repo under static/images/uploads
public_folder: "/images" # The src attribute for uploaded media will begin with /images/uploads
collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI
folder: "posts" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
@officialrajdeepsingh
officialrajdeepsingh / structure.md
Created August 17, 2022 08:28
nextjs, content layer, netlify cms structure folder

. ├── components │ ├── Banner.js │ ├── Footer.js │ ├── Header.js │ ├── ItemPost.js │ ├── Pagnation.js │ ├── Post.js │ └── Sidebar.js ├── config.js

@officialrajdeepsingh
officialrajdeepsingh / _document.js
Created August 17, 2022 08:23
create _document.js file in nextjs and add netlify cms
// _document.js
import Document, { Html, Head, Main, NextScript } from 'next/document'
class MyDocument extends Document {
static async getInitialProps(ctx) {
const initalProps = await Document.getInitialProps(ctx)
return initalProps
}
render() {
return (
<Html>
@officialrajdeepsingh
officialrajdeepsingh / _app.js
Last active July 11, 2022 12:36
Add configation for zustand in your nextjs
import { createContext } from 'react'
import { createStore } from 'zustand'
// create store
const store = createStore()
// create contact with react api
const StoreContext = createContext()
@officialrajdeepsingh
officialrajdeepsingh / read.md
Created July 8, 2022 17:32
new starship terminal rust
@officialrajdeepsingh
officialrajdeepsingh / _app.js
Last active June 24, 2022 07:33
create configuration for nextjs material UI for javascript
import * as React from 'react';
import Head from 'next/head';
import { ThemeProvider } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import { CacheProvider } from '@emotion/react';
import theme from '../config/theme';
import createEmotionCache from '../config/createEmotionCache';
// Client-side cache, shared for the whole session of the user in the browser.
const clientSideEmotionCache = createEmotionCache();
@officialrajdeepsingh
officialrajdeepsingh / _app.tsx
Last active June 24, 2022 08:02
material ui configation for nextjs
import * as React from 'react';
import Head from 'next/head';
import { AppProps } from 'next/app';
import { ThemeProvider } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import { CacheProvider, EmotionCache } from '@emotion/react';
import theme from '../config/theme';
import createEmotionCache from '../config/createEmotionCache';