npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

next-cloaking

v2.0.2

Published

Next-Cloaking is a NextJS package that allows to add "cloaking" functionality to every NextJS app. The term cloaking means rendering different content for the visitor of the website, depending on their User-Agent header. By doing this you can get better

Downloads

6

Readme

Add cloaking to NextJS

What's cloaking?

Cloaking in SEO refers to the practice of presenting different content or URLs to search engines and users. It is an attempt to deceive search engines and manipulate search rankings. It is used by many companies, but it is often not accepted by the search-engines and can result in penalties.

Warning! This can result in exponentially better results in SEO ranking but also in your site being removed from the algorithm or banned. I am not resposible for how you use this package.

How does this package work?

There's some ways to perform cloaking, but this package uses a custom _app.js file. To be specific it's a custom wrapper you can easily add. More about this in the documentation. This wrapper takes the headers of every request and checks for crawler-headers. Depending on your config it redirects the "bot" to a other url. Like example.com/blog/seo.

Installation.

First of all you should install the package:

npm install next-cloaking@latest

After it's installed you can switch to your app's _app.js file. By default that's in the src/ directory.

You now need to add a Wrapper to it. Here's an example of a plain app using NextJS:

import '@/styles/globals.css'
import { CloakingWrapper } from "next-cloaking";

const config = {
  seoRoute: "/seo-optimized"
}

export default function App({ Component, pageProps }) {
  return <CloakingWrapper Component={Component} pageProps={pageProps} config={config} />
}

From now on every request get's redirected to /*path/seo-optimized. But you do not want to redirect every user to it, but only search engines. You can add some of the engines to the config directly. You can modify the config a bit, here's an example:

const config = {
    seoRoute: "/seo-optimized",
    engines: [
        "Google"
    ]
}

This is just an example, adding it to the code is the first thing on the roadmap.

That's it and notes

You can now deploy your app to Vercel and enjoy the better ranking. Please note this can be banned by Google etc., and this package is just an explanation of it.