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

metalsmith-jsonld

v0.0.7

Published

A convenient way to add JSON-LD markup to all the pages on your Metalsmith site.

Downloads

31

Readme

Metalsmith JSON-LD

This module gives you a convenient way to add JSON-LD markup to all the pages on your Metalsmith site. There are several different ways you can add JSON-LD metadata:

Setting Global Defaults

Sometimes you'll want to insert the same metadata on EVERY page of your site. To do this, simply add a "defaults" value to your metalsmith-jsonld configuration in metalsmith.json. Ex:

"metalsmith-jsonld": {
  "defaults": [
    {
      "@context": "http://schema.org",
      "@type": "WebSite",
      "name": "Tandem",
      "alternateName": "The site for Tandem, a software strategy firm.",
      "url": "http://www.thinktandem.io"
    },
    {
      "@context": "http://schema.org",
      "@type": "Organization",
      "url": "http://www.thinktandem.io",
      "logo": "http://www.thinktandem.io/images/favicon.png",
      "sameAs": [
      "https://www.linkedin.com/company/think-tandem",
      "https://twitter.com/thinktandem"
      ]
    }
  ]
}

Adding Custom Values to a Specific Page.

Other times, you'll want to specify JSON-LD objects for a specific page you're creating. In this case, you can add a "jsonld" property to your frontmatter, and proceed to define an array of JSON-LD objects you'd like added to the page. Here's an example of the frontmatter from our About page:

---
layout: pages/about.html
title: Our Story
byline: What does it mean to tandemize?
description: All about Tandem, your friendly digital strategy firm from San Francisco, and the story of its co-founders Alec Reynolds and Mike Pirog.
pageSlug: about
image: /images/working.jpeg
jsonld:
  - "@context": http://schema.org/
    "@type": Person
    name: Alec Reynolds
    jobTitle: Co-founder
    url: http://www.alecreynolds.com
  - "@context": http://schema.org/
    "@type": Person
    name: Mike Pirog
    jobTitle: Co-founder
    url: http://www.twitter.com/pirogcommamike
lastmod: 2016-08-03
---

Adding Default Values to Collections

Finally, for many of your collections that have standardized frontmatter data, it's easiest to use the existing frontmatter to fill-in your JSON-LD (instead of having to specify the same information all over in custom JSON-LD frontmatter). In this case, add a "collections" property to your metalsmith-jsonld config in metalsmith.json that maps your frontmatter data to the JSON-LD schema properties.

For example, this configuration...

"metalsmith-jsonld": {
  "collections": {
    "articles": [
      {
        "@context": "http://schema.org", //"http://schema.org" isn't a frontmatter property, so the literal value will be used.
        "@type": "BlogPosting",
        "headline": "title", // "title" is an existing frontmatter property, so whatever the title of this article will be used.
        "alternativeHeadline": "teaser",
        "image": "mainImage",
        "keywords": "tags", 
        "publisher": {
          "@context": "http://schema.org",
          "@type": "Organization",
          "name": "Kalabox Inc. DBA Tandem",
          "url": "http://www.thinktandem.io",
          "logo": "http://www.thinktandem.io/images/favicon.png",
          "sameAs": [
            "https://www.linkedin.com/company/think-tandem",
            "https://twitter.com/thinktandem"
          ]
        },
        "datePublished": "date",
        "dateCreated": "date",
        "description": "teaser",
        "author": {
          "@type": "Person",
          "name": "author"
        }
      }
    ]
  }
}

...will produce the following JSON-LD:

{
  "@context": "http://schema.org",
  "@type": "BlogPosting",
  "alternativeHeadline": "An introduction to Tandem, who we are, what we do, and why you, a human being with places to go and people to see, should spend some time with us.",
  "author": {
    "@type": "Person",
    "name": "author"
  },
  "dateCreated": "2016-08-03T00:00:00.000Z",
  "datePublished": "2016-08-03T00:00:00.000Z",
  "description": "An introduction to Tandem, who we are, what we do, and why you, a human being with places to go and people to see, should spend some time with us.",
  "headline": "On evading death",
  "image": "holder.js/1000x200/#222:#aaa/text:{{title|slug}}",
  "keywords": [
    "deployment",
    "docker",
    "hosting",
    "localdev",
    "misc",
    "scaling",
    "strategy",
    "support",
    "training",
    "testing"
  ],
  "publisher": {
    "@context": "http://schema.org",
    "@type": "Organization",
    "logo": "http://www.thinktandem.io/images/favicon.png",
    "name": "Kalabox Inc. DBA Tandem",
    "sameAs": [
      "https://www.linkedin.com/company/think-tandem",
      "https://twitter.com/thinktandem"
    ],
    "url": "http://www.thinktandem.io"
  }
}

Between these three options, you have some powerful tools to create rich JSON-LD markup and optimize your site's appearance in Google search results!