
In SEO, web development ensures your website stands out on the search engine result page (SERP). SEO is not only about finding the right keywords and writing top content, it is also about how you build your website.
Like how marketeers and content writers use tools like SEMrush, Ahref etc, as developers one should explore NEXT JS features for developing SEO-friendly websites.
Next JS is an open-source react-based framework for developing websites and applications. Next js has various features like server-side rendering, static site generator, Image optimisation, and custom Head tag which ensures websites are SEO friendly.
Server-side rendering (SSR) is the cornerstone of NEXT js. SSR ensures that page content is built before it is rendered on the client side. This ensures that when bots crawl the site they have content to index.
Here is a sample code for server-side rendering:
export async function getServerSideProps(context) {
const res = await fetch(`https://api.example.com/data`);
const data = await res.json();
return { props: { data } };
}
function Page({ data }) {
// Render data...
}
Next, the JS custom image component handles image optimisation automatically by comparing and serving images in a format which is suitable for the site. Its lazy loading feature ensures the image is loaded only when it comes into view.
import Image from 'next/image'
export default function Page() {
return (
<Image
src="/profile.png"
width={500}
height={500}
alt="Picture of the author"
/>
)
}
Next, the js custom head component helps you to change the title, meta description, canonical URL, and schema dynamically which helps in improving the click rate.
<Head>
<title>{title}</title>
<meta name="robots" content="index, follow" />
<meta name="description" content={summary} />
<link rel="canonical" href={canonicalUrl} />
<meta property="og:title" content={title} />
<meta property="og:description" content={summary} />
<meta property="og:type" content="article" />
<meta property="og:url" content={canonicalUrl} />
<meta property="og:image" content={image?.fields?.file?.url} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={summary} />
<meta name="twitter:image" content={image?.fields?.file?.url} />
{/* Insert JSON-LD schema using dangerouslySetInnerHTML */}
<script
id="json-ld-schema"
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: schemaString }}
></script>
</Head>
Next JS automatic code splitting, dynamic component, and purge css ensure the website loads faster.
NEXT js provides a custom script component which helps to load third-party scripts. Its strategy attribute provides various ways to load scripts like lazyload, before interactive etc, which improves website performance.
Using Next Js will ensure your site is optimized for SEO so that it is easy to index.
Ask ten Indian business owners what branding means and nine will point at a logo. That answer costs them money every month — in discounts they didn’t ...
Most lead generation advice you’ll find online was written for a US software company with a $3,000 monthly ad budget and a buyer who fills out forms. ...
You can run the sharpest Google Ads campaign in your category and still lose money if the page behind the ad leaks visitors. Landing page optimization...