Skip to content

Commit 6f5ea7b

Browse files
committed
Add JsonLd
1 parent 42f6c78 commit 6f5ea7b

File tree

14 files changed

+178
-50
lines changed

14 files changed

+178
-50
lines changed

app/(home)/SearchBox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const SearchBox = ({ formAction }) => {
1010
className="block flex-1 bg-transparent pl-4 text-lg md:text-xl outline-none"
1111
name="username"
1212
type="text"
13-
placeholder="Enter your github Username"
13+
placeholder="Enter github Username"
1414
/>
1515

16-
<button className="w-14 bg-gray-700 px-5 md:py-3.5 hover:bg-gray-600 group-focus-within:bg-gray-600 group-focus-within:text-white md:w-20 ">
16+
<button className="w-14 bg-gray-700 px-5 py-3 md:py-3.5 hover:bg-gray-600 group-focus-within:bg-gray-600 group-focus-within:text-white md:w-20 ">
1717
<FaSearch className="mx-auto text-xl md:text-2xl" />
1818
</button>
1919
</form>

app/(home)/page.js

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import RecentProfiles from '@/models/RecentProfiles';
44
import connectDb from '@/lib/connectDb';
55
import Link from 'next/link';
66
import GridContainer from '@/components/GridContainer';
7+
import { unstable_noStore as noStore } from 'next/cache';
8+
import Header from '@/components/Header';
79

810
export default async function Home() {
11+
noStore();
912
await connectDb();
1013
const recenetProfiles = await RecentProfiles.find({}).sort({ updatedAt: 'desc' }).limit(8);
1114

@@ -16,17 +19,20 @@ export default async function Home() {
1619
};
1720

1821
return (
19-
<main className="px-4">
20-
<div className="mx-auto max-w-screen-md pt-[15vh] text-center md:pt-[16vh]">
21-
<h1 className="text-gradient text-4xl font-bold md:text-7xl">Git Glance</h1>
22-
<p className="text-gradient mb-16 mt-2 text-xl font-medium md:text-3xl ">
23-
Visualize Your GitHub Profile
24-
</p>
22+
<>
23+
<Header />
2524

26-
<SearchBox formAction={formAction} />
27-
</div>
25+
<main className="px-4">
26+
<div className="mx-auto max-w-screen-md pt-[15vh] text-center md:pt-[12vh]">
27+
<h1 className="text-gradient text-4xl font-bold md:text-7xl">Git Glance</h1>
28+
<p className="text-gradient mb-16 mt-2 text-xl font-medium md:text-3xl ">
29+
Visualize Your GitHub Profile
30+
</p>
2831

29-
{/* <div className="mx-auto mt-28 max-w-screen-xl text-left md:mt-40">
32+
<SearchBox formAction={formAction} />
33+
</div>
34+
35+
{/* <div className="mx-auto mt-28 max-w-screen-xl text-left md:mt-40">
3036
<h2 className="text-gradient text-xl font-semibold md:text-3xl">Recent Profiles</h2>
3137
3238
<div className="mt-4 grid grid-cols-1 gap-4 md:grid-cols-4">
@@ -50,31 +56,34 @@ export default async function Home() {
5056
))}
5157
</div>
5258
</div> */}
53-
<div className="mx-auto mt-32 max-w-screen-xl md:mt-36">
54-
<GridContainer
55-
className={'grid-cols-1 gap-3 md:grid-cols-4'}
56-
name={'Recent Profiles'}
57-
description={'Profiles that have been viewed recently'}
58-
>
59-
{recenetProfiles.map(profile => (
60-
<Link
61-
key={profile._id}
62-
href={`/${profile.username}`}
63-
className="box flex items-center gap-3 md:gap-5 text-left"
64-
>
65-
<img
66-
src={profile.avatarUrl}
67-
alt={profile.username}
68-
className="grow-0 size-10 smd:ize-12 rounded-full"
69-
/>
70-
<div>
71-
<p className="text-base font-semibold md:text-lg">{profile.name ?? profile.username}</p>
72-
<p className="text-sm text-gray-400 md:text-base">@{profile.username}</p>
73-
</div>
74-
</Link>
75-
))}
76-
</GridContainer>
77-
</div>
78-
</main>
59+
<div className="mx-auto mt-32 max-w-screen-xl md:mt-36">
60+
<GridContainer
61+
className={'grid-cols-1 gap-3 md:grid-cols-4'}
62+
name={'Recent Profiles'}
63+
description={'Profiles that have been viewed recently'}
64+
>
65+
{recenetProfiles.map(profile => (
66+
<Link
67+
key={profile._id}
68+
href={`/${profile.username}`}
69+
className="box flex items-center gap-3 text-left md:gap-5"
70+
>
71+
<img
72+
src={profile.avatarUrl}
73+
alt={profile.username}
74+
className="size-10 grow-0 rounded-full md:size-12"
75+
/>
76+
<div>
77+
<p className="text-base font-semibold md:text-lg">
78+
{profile.name ?? profile.username}
79+
</p>
80+
<p className="-mt-1 text-sm text-gray-400 md:text-base">@{profile.username}</p>
81+
</div>
82+
</Link>
83+
))}
84+
</GridContainer>
85+
</div>
86+
</main>
87+
</>
7988
);
8089
}

app/[username]/layout.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Header from '@/components/Header';
2+
3+
const layout = ({ children }) => {
4+
return (
5+
<div>
6+
{children}
7+
</div>
8+
);
9+
};
10+
11+
export default layout;

app/[username]/page.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import fetchActivity from '@/utils/fetchActivity';
1515
import { notFound } from 'next/navigation';
1616
import RecentProfiles from '@/models/RecentProfiles';
1717
import connectDb from '@/lib/connectDb';
18+
import RateLimit from '@/components/RateLimit';
1819

1920
// meta data
2021
export const generateMetadata = async ({ params: { username } }) => {
@@ -65,7 +66,8 @@ const page = async ({ params: { username } }) => {
6566
} = await fetchUserData(username);
6667

6768
return (
68-
<main className="mx-auto max-w-screen-xl space-y-8 px-3 pb-10 pt-16 md:space-y-16">
69+
<main className="mx-auto max-w-screen-xl space-y-8 px-3 pb-10 -mt-8 md:space-y-16">
70+
<RateLimit />
6971
<UserInfo username={username} {...userInfo} />
7072
<Stats stats={userStats} />
7173
<Languages languages={languagesSize} />

app/layout.js

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import './globals.scss';
22
import GithubCorner from '@/components/GithubCorner';
33
import ParticlesJs from '@/components/ParticlesJs';
44
import ChartInit from '@/components/ChartInit';
5-
import { GoogleTagManager } from '@next/third-parties/google';
5+
import { GoogleAnalytics } from '@next/third-parties/google';
6+
import Footer from '@/components/Footer';
7+
import RateLimit from '@/components/RateLimit';
8+
import Header from '@/components/Header';
69

710
export const metadata = {
811
title: 'GitHub Profile Visualizer',
912
description:
1013
'Gain valuable insights into your GitHub profile effortlessly. Explore your coding journey with intuitive visualizations and unlock a deeper understanding of your contributions, repositories, and activity. Dive into your GitHub universe with ease and clarity.',
11-
colorScheme: 'dark',
1214
openGraph: {
1315
title: 'Git Glance',
1416
images: `${process.env.BASE_URL}/banner.png`,
@@ -19,22 +21,46 @@ export const metadata = {
1921
};
2022

2123
export default function RootLayout({ children }) {
24+
const jsonLd = {
25+
'@context': 'https://schema.org',
26+
'@type': 'WebSite',
27+
name: 'GitGlance',
28+
url: process.env.BASE_URL,
29+
alternateName: [
30+
'GitHub Profile Visualizer',
31+
'GitHub Profile Analyzer',
32+
'GitHub Profile Insights',
33+
'GitHub Profile Stats',
34+
],
35+
36+
'@type': 'SoftwareApplication',
37+
name: 'GitGlance',
38+
operatingSystem: 'Web',
39+
applicationCategory: 'DeveloperApplication',
40+
offers: {
41+
'@type': 'Offer',
42+
price: '0',
43+
priceCurrency: 'USD',
44+
},
45+
};
2246
return (
2347
<html lang="en">
24-
<GoogleTagManager gtmId="GTM-K3M9GGRW" />
48+
<GoogleAnalytics gaId="G-C2EK8WWR4Y" />
2549
<head>
50+
<meta name="google-site-verification" content="koBxrTJwnDsFGPdjUesKqkWAgmhsZyvWWlDkwv4cOpw" />
2651
<meta name="color-scheme" content="dark" />
2752
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
2853
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
2954
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
3055
<link rel="manifest" href="/site.webmanifest" />
56+
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} />
3157
</head>
3258

3359
<body>
3460
<ChartInit />
3561
<ParticlesJs />
36-
<GithubCorner />
37-
{children}
62+
<div className="min-h-[calc(100vh-5rem)]">{children}</div>
63+
<Footer />
3864
</body>
3965
</html>
4066
);

app/loading.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CgSpinner } from 'react-icons/cg';
22

33
const loading = () => {
44
return (
5-
<div className="grid min-h-screen place-items-center">
5+
<div className="grid min-h-[calc(100vh-6rem)] place-items-center">
66
<CgSpinner className="animate-spin text-5xl md:text-6xl" />
77
</div>
88
);

app/sitemap.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ import RecentProfiles from '@/models/RecentProfiles';
44
export default async function sitemap() {
55
await connectDb();
66
const recenetProfiles = await RecentProfiles.find({}).sort().limit(250);
7-
const baseUrl = 'https://git-glance.vercel.app';
7+
const baseUrl = process.env.BASE_URL;
88

9-
const sitemap = recenetProfiles.map(profile => ({
9+
const sitemapProfils = recenetProfiles.map(profile => ({
1010
url: `${baseUrl}/${profile.username}`,
1111
changefreq: 'monthly',
1212
priority: 0.7,
1313
}));
1414

15+
const sitemap = [
16+
{
17+
url: baseUrl,
18+
changefreq: 'weekly',
19+
priority: 1,
20+
},
21+
...sitemapProfils
22+
]
23+
1524
return sitemap;
1625
}

components/Footer.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const Footer = () => {
2+
return (
3+
<footer className=" mt-10 border-t border-gray-700 bg-gray-800 p-2.5 text-center text-sm text-gray-300 backdrop-brightness-150 md:text-base [&_a]:text-cyan-400 hover:[&_a]:underline">
4+
<div className="mx-auto max-w-screen-lg">
5+
Git Glance is built with <a href="https://nextjs.org">Nextjs v14.1.0</a> &{' '}
6+
<a href="https://tailwindcss.com/">TailwindCSS</a> By{' '}
7+
<a href="http://github.com/devXprite/">devxprite</a>. Source is on{' '}
8+
<a href="github.com/devXprite/gitglance">Github</a>
9+
</div>
10+
</footer>
11+
);
12+
};
13+
14+
export default Footer;

components/GithubCorner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
const GithubCorner = () => {
44
return (
55
<>
6-
<a href="https://your-url" className="github-corner" aria-label="View source on GitHub">
6+
<a href="https://github.com/devxpite/gitglance" className="github-corner" aria-label="View source on GitHub">
77
<svg
88
width="80"
99
height="80"

components/Header.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Link from 'next/link';
2+
3+
const Header = () => {
4+
return (
5+
<header className=" border-gray-700 bg-gray-900 px-3 py-3">
6+
<div className="mx-auto flex max-w-screen-xl items-center">
7+
<Link href="/" className="text-gradient text-xl font-bold">
8+
Git Glance
9+
</Link>
10+
{/* <img
11+
className="ml-auto h-9"
12+
src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=434915&theme=neutral" alt="" /> */}
13+
</div>
14+
</header>
15+
);
16+
};
17+
18+
export default Header;

0 commit comments

Comments
 (0)