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
my-app@0.1.0 /home/radewala_2/my-app
├─┬ @testing-library/jest-dom@5.16.3
│ ├── @babel/runtime@7.17.8
│ ├── @types/testing-library__jest-dom@5.14.3
│ ├── aria-query@5.0.0
│ ├── chalk@3.0.0
│ ├── css.escape@1.5.1
│ ├── css@3.0.0
│ ├── dom-accessibility-api@0.5.13
│ ├── lodash@4.17.21
@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
my-app@0.1.0 /home/radewala_2/npmTutorial/my-app
├─┬ eslint-config-next@12.1.0
│ ├─┬ @next/eslint-plugin-next@12.1.0
│ │ └─┬ glob@7.1.7
│ │ ├── fs.realpath@1.0.0
│ │ ├─┬ inflight@1.0.6
│ │ │ ├── once@1.4.0 deduped
│ │ │ └── wrappy@1.0.2
│ │ ├── inherits@2.0.4
@officialrajdeepsingh
officialrajdeepsingh / index.js
Created April 3, 2022 10:20
npm ls --all command help the list of packages in the next.js.
my-next@0.1.0 /home/radewala_2/my-next
├─┬ eslint-config-next@12.1.4
│ ├─┬ @next/eslint-plugin-next@12.1.4
│ │ └─┬ glob@7.1.7
│ │ ├── fs.realpath@1.0.0
│ │ ├─┬ inflight@1.0.6
│ │ │ ├── once@1.4.0 deduped
│ │ │ └── wrappy@1.0.2
│ │ ├── inherits@2.0.4
│ │ ├── minimatch@3.1.2 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();