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

js-seopreview

v1.0.1

Published

A simple plugin that allows you to preview meta tag data in a styled Google and Facebook link preview. You can bind the preview to inputs to get live preview while editing perfect for blog and CMS applications.

Downloads

78

Readme

JS SEOPreview Logo

JS SEOPreview

Version 1.0.0

Preview Google and Facebook meta data like a ~~duck~~ boss

A simple jquery plugin that allows you to preview Google and Facebook meta data binded to inputs for live real-time editing. Perfect for any blog post editing pages or when creating CMS applications.

View Demo and Documentation


Usage

Add the live preview plugin to your tag or before the closing tag:

<script type="text/javascript" src="/js/jquery-seopreview.js"></script>

Make sure to add the CSS styling for the preview dialog window in your head:

<link href="/css/jquery-seopreview.css" rel="stylesheet" type="text/css">

The styles included are default styles for the live SEO preview area only.


Add to Your Page

Add a div where you want each preview to appear individually.

<div id="seopreview-google"></div>

<div id="seopreview-facebook"></div>

Add HTML form inputs to bind on .keyUp on your page for live editing.

<input type="text" id="meta-title" />
<input type="text" id="meta-url" />
<textarea id="meta-desc"></textarea>
<input type="text" id="meta-featured-image" />

Configuration

You can also bind inputs to get live preview updates on change.

Simple

$.seoPreview({
  google_div: "#seopreview-google",
  facebook_div: "#seopreview-facebook",
  metadata: {
    title: $('#meta-title'),
    desc: $('#meta-desc'),
    url: {
      full_url: $('#meta-url')
    }
  },
  facebook: {
      featured_image: $('#meta-featured-image')
  }
});

You can also use static data instead of passing jQuery DOM elements.

Advanced

$.seoPreview({
  google_div: "#seopreview-google",
  facebook_div: "#seopreview-facebook",
  metadata: {
      title: "MonetizeDesign - SEO Live Preview jQuery Plugin",
      desc: "The jQuery SEO Preview Plugin is a simple plugin that allows you to preview meta tag data in a styled Google and Facebook link preview. You can bind the preview to inputs for live editing perfect for blog and CMS applications when you need to edit social meta data.",
      url: {
          full_url: "https://monetizedesign.github.io/js-seopreview/",
          use_slug: false,
          base_domain: "",
          auto_dash: true
      }
  },
  google: {
      show: true,
      date: true
  },
  facebook: {
      show: true,
      featured_image: ""
  }
});

Options

Explanation of the options available.

  • google_div & facebook_div
    The ID or class of any element to replace HTML with preview box.

  • use_slug
    If true it will override the full_url and use the base_domain.

  • auto_dash
    Default is true and it will clean and format the entered URL.

  • google.date
    Default is true and it will show the current date in Google description.

  • facebook.show & google.show
    Default is true and it will show of hide the preview box.

Note: Character limits for the title, url and description are hard-coded into the plugin using the latest max length.


Dependencies

  • jQuery Core 2.2.4 or higher must be loaded
  • CSS Cleanslate * Inluded renamed as .md-js-cleanslate


TODO

  • Add more preview options (Linkedin, Google+, Reddit, etc)
  • Add override CSS documentation

Changelog

  • Launch version 1.0.0 to github

MIT License

Copyright 2018 © MonetizeDesign.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

You CANNOT in anyway use this code to impesonate Google or Facebook. All Trademarks are to their respective owners.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.