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

jbs-seo-handlebars

v1.0.2

Published

SEO Metatags and Twitter Card and OpenGraphs

Downloads

4

Readme

JumpButton Studio SEO for Handlebars

Install JBS SEO Handlebars

JumpButton Studio SEO

Add all metatags quickly for Handlebars and Express.JS Projects.

JBS Seo Handlebars Version

Update Log

After noticing a large amount of downloads for this plugin I decided to write a README.MD file as you can see

v 1.0.2

* Added some bug fixes to the default values.
+ Added a new: seo.getDefaultTitle()

Install

npm i --save jbs-seo-handlebars

Basic Usage

Directory Structure:

.
├── app.js
└── views
    ├── contact.hbs
    ├── home.hbs
    └── layouts
        └── main.hbs

2 directories, 3 files

app.js:

Creates a super simple Express app with Handlebars view engine and how to implement the SEO System.

const PORT = 8080;
const express = require('express');
const exphbs = require('express-handlebars');
const seo = require('jbs-seo-handlebars')({
	defaultAuthor: "Lycrios", // Author Tag
	defaultDescription: "A handlebars/express package for easy SEO implmentation.", // Description Tag
	defaultUrl: "https://www.jumpbuttonstudio.com/", // Canonical and og:url Tags
	defaultImage: "https://www.jumpbuttonstudio.com/img/logo.png", // og:image
	defaultKeywords: "seo,handlebars,express", // Keywords Tag
	defaultTitle: "JBS Seo Handlebars", // The Default Title
	og_type: "website", // Optional
	robots: "index,follow" // Optional
}); // These are default values that can be overridden.

const app = express();

app.engine('.hbs', exphbs({
	defaultLayout: 'main',
	extname: '.hbs' // So we can use the shortform extension for handlebars
}));
app.set('view engine', '.hbs');

app.get("/", (req, res) => {
	res.render("home", {
		tags: seo.seoMetaTags(),
		title: seo.getDefaultTitle()
	});
});

app.get("/contact", (req, res) => {
	res.render("contact", {
		tags: seo.seoMetaTags({
			title: "Contact Us" // Override the title tag
		}),
		title: "Contact Us"
	});
});

app.listen(PORT, () => {
	console.log("Server Ready. Listening for connections on " + PORT);
});

views/layouts/main.hbs

The main layout is the HTML page wrapper which can be reused for the different views of the app. {{{body}}} is used as a placeholder for where the main content should be rendered.

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	{{{tags}}}
	<title>{{title}}</title>
</head>
<body>
	{{{body}}}
</body>
</html>

views/home.hbs

The content for the app's home view which will be rendered into the layout's {{{body}}}.

<h1>Example App: {{title}}</h1>

views/contact.hbs

The content for the app's contact view which will be rendered into the layout's {{{body}}}.

<h1>Contact Us Page</h1>

Rendered HTML

This is the rendered html for the home page.

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="description" content="A handlebars/express package for easy SEO implmentation.">
	<meta name="author" content="Lycrios">
	<meta name="keywords" content="seo,handlebars,express">
	<meta property="twitter:title" content="JBS Seo Handlebars">
	<meta name="twitter:card" content="A handlebars/express package for easy SEO implmentation." />
	<meta name="twitter:description" content="A handlebars/express package for easy SEO implmentation." />
	<meta property="og:type" content="website">
	<meta property="og:title" content="JBS Seo Handlebars">
	<meta property="og:description" content="A handlebars/express package for easy SEO implmentation." />
	<meta property="og:url" content="https://www.jumpbuttonstudio.com/" />
	<meta property="og:image" content="https://www.jumpbuttonstudio.com/img/logo.png" />
	<meta name="robots" content="index,follow">
	<meta name="googlebot" content="index,follow">
	<link rel="canonical" href="https://www.jumpbuttonstudio.com/"/>
	<title>JBS Seo Handlebars</title>
</head>
<body>
	<h1>Example App: JBS Seo Handlebars</h1>
</body>
</html>