JS SEOPreview

Preview Google and Facebook meta data like a duck boss

Version 1.0.1

Getting Started

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.

Star npm version


Usage

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

<script type="text/javascript" src="/js/jquery-seopreview.js"></script>
<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 via NPM

$ npm install js-seopreview

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: "A very awesome live editable SEO plugin for jQuery",
      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 or hide the preview box.

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

Preview & Demo

Edit the Title, URL or Desc inputs below to see the SEO preview change on the .keyup function.

* Note: above inputs are not styled by the JS SEOPreview plugin. Only the below preview boxes are styled to resemble real results with the plugin.


Google Preview
Facebook Preview

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.1 to NPM repository
  • 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.

Remember: 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.