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
@officialrajdeepsingh
officialrajdeepsingh / packaGE
Created March 29, 2022 11:25
npm package depth list
[email protected] /home/radewala_2/my-app
├─┬ @testing-library/[email protected]
│ ├── @babel/[email protected]
│ ├── @types/[email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
@officialrajdeepsingh
officialrajdeepsingh / index.js
Created April 3, 2022 08:45
npm package all list for nextjs
radewala_2@cloudshell:~/npmTutorial/my-app$ npm ls --all
[email protected] /home/radewala_2/npmTutorial/my-app
├─┬ [email protected]
│ ├─┬ @next/[email protected]
│ │ └─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected] deduped
│ │ │ └── [email protected]
│ │ ├── [email protected]
@officialrajdeepsingh
officialrajdeepsingh / index.js
Created April 3, 2022 10:20
npm ls --all command help the list of packages in the next.js.
[email protected] /home/radewala_2/my-next
├─┬ [email protected]
│ ├─┬ @next/[email protected]
│ │ └─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected] deduped
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected] deduped
@officialrajdeepsingh
officialrajdeepsingh / sitemap.xml
Last active April 16, 2022 05:54
sitemap.xml
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>/blog/</loc>
<lastmod>2022-04-03T09:54:55+00:00</lastmod>
</url>
<url>
<loc>/categories/</loc>
<lastmod>2022-04-03T09:54:55+00:00</lastmod>
</url>
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
// change file code in default template
{{- if or $.IsHome $.IsSection -}}
{{- $pages = (where (where $pctx.RegularPages ".Section" "posts") "Kind" "page") -}}
{{- else -}}
{{- $pages = (where (where $pctx.Pages ".Section" "posts") "Kind" "page") -}}
@officialrajdeepsingh
officialrajdeepsingh / [page].js
Last active June 9, 2022 05:03
create pagination for nextjs static base article
import { NextSeo } from 'next-seo';
import Post from '../../components/Post'
import Banner from "../../components/Banner";
import Sidebar from "../../components/Sidebar"
import { sortByDate, ImageUrl,pageCount } from '../../utils'
import { allPosts } from "contentlayer/generated";
import { pick } from "@contentlayer/client";
import Pagnation from '../../components/Pagnation';
import { show_per_page } from "../../config"
@officialrajdeepsingh
officialrajdeepsingh / Pagination.js
Created June 8, 2022 07:53
Pagination component in nextjs static blog
import React from 'react'
import Link from "next/link";
import { useRouter } from "next/router";
function Pagnation({totalPostCount}) {
let router = useRouter()
/*
pages give number,base on number we create a array. base on array we map a list elements
totalPostCount = 3
@officialrajdeepsingh
officialrajdeepsingh / index.js
Created June 8, 2022 12:44
index.js for get the ten posts
// fetch first ten posts
export async function getStaticProps() {
// help of pich get require filter value
const posts = allPosts.map((post) => pick(post, ["title", "date", "slug", "description", "summary", "draft", "image", "images", "tags", "categories","id"]));
// sort article base on date
let postSortByDate = posts.sort(sortByDate)
// filter publish posts
@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';
@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();