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

sk-seo

v0.4.3

Published

A lightweight, no depenencies, Sveltekit SEO component to save your time

Downloads

857

Readme

Minzip size Installs GitHub Repo stars GitHub Forks

Installation

npm i -D sk-seo

If you're using @adapter-static, make sure to follow this

Usage

import the file

<script>
  import Seo from 'sk-seo';
</script>

Then place this code anywhere in your svelte file

<Seo 
  title="Contact"
  description="Where to contact Dahoom AlShaya, whether for business needs or general inquiries"
  keywords="Contact, business, inquiries"
/>

Standard Parameters

| Parameter | Description | Type | Default | | ------------- | ----------------------- | ------- | ----------------------- | | title| The title of the page | string | ~ | | description| The description of the page | string | ~ | | keywords| The keywords to be used for search engine optimization or search | string | ~ | | index| Whether or not crawlers should crawl this page | boolean | true |

Advanced

All these choices are optional | Parameter | Description | Type | Default | | ------------- | ----------------------- | ------- | ----------------------- | | siteName| The name of the site | string | ~ | | canonical| Current URL of the page. For resolving duplicate pages with SEO | string | ~ | | twitter| Indicates whether Twitter meta tags should be generated | boolean | true | | openGraph| Indicates whether og / OpenGraph meta tags should be generated | boolean | true | | schemaOrg| Indicates whether jsonLd/SchemaOrg meta script should be generated | boolean | false | | schemaType| The type of jsonld schema (Person, Organisation, Create) @default Person,Organisation | string/Array | ['Person', 'Organisation'] | | jsonld| Appends contents to jsonld script (used by search engines for names, contact information, etc) | object {} | ~ | | imageURL| The URL of the image to be used for preview (twitter, discord image preview when your url is shared) | string | ~ | | logo| The logo image URL for SchemaOrg | string | ~ | | author| Represents the author of the page | string | ~ | | socials| An array of social media links for SchemaOrg | Array | ~ | | name| The name to be used for SchemaOrg | string | ~ |

How it works

The component uses <svelte:head> to place meta tags that are filled with sveltekit $page and inputted variables, this means that a lot of the tags are automatically filled for you for each page in your website. An example of this is og:url, which requires the url of the current page:

<meta property="og:url" content="{$page.url}">

Extendable

If you want to use an unusual meta tag or use your own custom one (eg: google site verification). It's easy as:

<Seo title="abc" description="def">
  <meta name="google-site-verification" content="abcd123">
</Seo>

Why

A lot of SEO is repeated boilerplate for twitter, open graph and schemaOrg. This component's sole purpose is to do away with all the annoyances and just help you focus on your content without having to spend hours making sure all the meta tags are correctly set on each and every page.

I initially made this for my personal website and decided to open source it to so that no one has to go through the headache I did to make sure everything is functional.

Keywords?!

It's optional for anyone who wants to use it. Google doesn't rely on keywords anymore but apparently bing still does put a tiny weight on it. I personally use keywords for my personal website's search function.

Prerendering

If you are using adapter-static, you need to add your base URL in svelte.config.js, otherwise $page.url will default to http://sveltekit-prerender.

// svelte.config.js
const config = {
  kit: {
    prerender: {
      origin: 'https://mossberg.dev' // Replace with your URL.
    }
  }
}

Duplicated Meta?

If you're behind Cloudflare and find yourself with duplicated meta tags, then you should disable auto-minify!

Speed -> Optimization -> Content Optimization -> Auto Minify -> UNCHECK HTML

License

MIT License

Extra

If you have any ideas of fixes/imporvements/features that could be added then please suggest them here

Credits

  • Thanks to ArchangelGCA for the multiple quality of life imporvements and fixes!
  • Thanks to RodneyLab for his blog post which taught me about jsonLd and for suggesting an interesting snippet of code to render jsonLd

As seen on

Svelte Blog The Guardian New York Times