Skip to content

Instantly share code, notes, and snippets.

View officialrajdeepsingh's full-sized avatar

Rajdeep Singh officialrajdeepsingh

View GitHub Profile
@officialrajdeepsingh
officialrajdeepsingh / docker-compose.yml
Created October 15, 2022 11:45
docker-compose file for ghost cms
version: '3.8'
services:
blog:
image: ghost
restart: always
ports:
- 8080:2368
volumes:
- ./assets:/var/lib/ghost/content/themes/fastest/assets
- ./partials:/var/lib/ghost/content/themes/fastest/partials
@officialrajdeepsingh
officialrajdeepsingh / index.js
Created August 22, 2022 08:21
Auth of next-auth
// pages/index.js
import Login from '../components/login';
import { getProviders } from "next-auth/react"
import { unstable_getServerSession } from "next-auth/next"
import { authOptions } from "./api/auth/[...nextauth]";
export default function Home({ posts, Session , providers }) {
// pages/index.js
import Login from '../components/login';
import { useSession, getProviders } from "next-auth/react"
// rest import here
export default function Home({ posts, totalPostCount, providers }) {
// get session from next-auth
@officialrajdeepsingh
officialrajdeepsingh / Login.js
Last active August 22, 2022 07:44
Login component for next-auth
// components/login.js
import React from 'react'
import { signIn } from "next-auth/react"
export default function SignIn({ providers }) {
return (
<>
<div className="container mb-5">
<div className="col-md-6 mx-auto text-center">
// 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>