Skip to content

Commit

Permalink
chore: improve SEO
Browse files Browse the repository at this point in the history
  • Loading branch information
rupali-codes authored Jan 11, 2025
2 parents 9b4f78a + 0a2bfc9 commit 2726a47
Show file tree
Hide file tree
Showing 5 changed files with 4,564 additions and 6,507 deletions.
42 changes: 42 additions & 0 deletions pages/api/sitemap.xml.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { NextApiRequest, NextApiResponse } from 'next';
import { sidebarData } from 'database/data';

export default function handler(req: NextApiRequest, res: NextApiResponse) {
const baseUrl = 'https://linkshub.dev';
const today = new Date().toISOString().split('T')[0]; // Get today's date in YYYY-MM-DD format

const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>${baseUrl}</loc>
<lastmod>${today}</lastmod>
<priority>1.0</priority>
</url>
${sidebarData
.map(
(category) => `
<url>
<loc>${baseUrl}/${category.category}</loc>
<lastmod>${today}</lastmod>
<priority>0.8</priority>
</url>
${category.subcategory
.map(
(subcategory) => `
<url>
<loc>${baseUrl}/${category.category}${subcategory.url}</loc>
<lastmod>${today}</lastmod>
<priority>0.7</priority>
</url>`
)
.join('')}
`
)
.join('')}
</urlset>`;

// Set the response headers and return the sitemap as XML
res.setHeader('Content-Type', 'application/xml');
res.setHeader('Cache-Control', 'public, max-age=3600, s-maxage=3600');
res.status(200).send(sitemap);
}
29 changes: 24 additions & 5 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface RatingForkProps {
iconBgColor: string
btnBgColor: string
btnTextColor: string
btnHoverColor:string
btnHoverColor: string
btnText: string
}

Expand Down Expand Up @@ -89,7 +89,7 @@ const RatingForkComponent: React.FC<RatingForkProps> = ({
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
style={buttonStyle}
className='text-base p-2 rounded-lg text-center w-full'
className="text-base p-2 rounded-lg text-center w-full"
>
{btnText}
</button>
Expand Down Expand Up @@ -136,20 +136,21 @@ export default function Home() {
return (
<>
<Head>
<title>LinksHub</title>
<title>LinksHub - A hub of ready-to-use tech resources</title>
<meta name="title" content="LinksHub" />
<meta
name="description"
content="LinksHub is the ultimate hub of ready-to-use tech resources made for and by the community. Whether you are professional or enthusiast, we have what you need to help you grow."
content="LinksHub is the ultimate hub for free tech resources, tools, and libraries. Explore LinksHub to discover developer tools and resources tailored for growth."
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="keywords"
content="LinksHub, developers, free resources, tools, software, libraries, frameworks, applications, websites"
content="LinksHub, developers, free resources, tools, software, libraries, frameworks, applications, websites, free tools, developer tools, tech resources"
/>
<meta name="author" content="Rupali Haldiya" />
<meta name="robots" content="index, follow" />
<meta name="revisit-after" content="7 days" />
<link rel="canonical" href="https://linkshub.dev" />

{/* Open Graph */}
<meta property="og:url" content="https://linkshub.dev" />
Expand Down Expand Up @@ -195,6 +196,24 @@ export default function Home() {
/>

<link rel="icon" href="/new-icon.png" className="rounded-full" />
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'WebSite',
name: 'LinksHub',
url: 'https://linkshub.dev',
description:
'LinksHub is the ultimate hub for free, ready-to-use tech resources, tools, and libraries for developers and tech enthusiasts.',
potentialAction: {
'@type': 'SearchAction',
target: 'https://linkshub.dev/search?q={search_term_string}',
'query-input': 'required name=search_term_string',
},
}),
}}
/>
</Head>
<section
data-custom="restrict-click-outside"
Expand Down
Loading

0 comments on commit 2726a47

Please sign in to comment.