Coder Social home page Coder Social logo

bradparks / yoastseo.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yoast/yoastseo.js

0.0 2.0 0.0 7.24 MB

Analyze content on a page and give SEO feedback as well as render a snippet preview.

License: GNU General Public License v3.0

JavaScript 98.08% CSS 1.92%

yoastseo.js's Introduction

Build Status Code Climate Test Coverage Inline docs

YoastSEO.js

Text analysis and assessment library in JavaScript. This library can generate interesting metrics about a text and assess these metrics to give you an assessment which can be used to improve the text.

Screenshot of the assessment of the given text

Also included is a preview of the Google search results which can be assessed using the library.

Installation

You can install YoastSEO.js using npm:

npm install https://github.com/Yoast/YoastSEO.js#develop

Usage

If you want the complete experience with UI and everything you can use the App. You need to have a few HTML elements to make this work: A snippet preview container, a focusKeyword input element and a content input field.

var SnippetPreview = require( "yoastseo" ).SnippetPreview;
var App = require( "yoastseo" ).App;

window.onload = function() {
	var focusKeywordField = document.getElementById( "focusKeyword" );
	var contentField = document.getElementById( "content" );

	var snippetPreview = new SnippetPreview({
		targetElement: document.getElementById( "snippet" )
	});

	var app = new App({
		snippetPreview: snippetPreview,
		targets: {
			output: "output"
		},
		callbacks: {
			getData: function() {
				return {
					keyword: focusKeywordField.value,
					text: contentField.value
				};
			}
		}
	});

	app.refresh();

	focusKeywordField.addEventListener( 'change', app.refresh.bind( app ) );
	contentField.addEventListener( 'change', app.refresh.bind( app ) );
};

You can also invoke internal components directly to be able to work with the raw data. To get metrics about the text you can use the Researcher:

var Researcher = require( "yoastseo" ).Researcher;

var researcher = new Researcher( new Paper( "Text that has been written" ) );

console.log( researcher.getResearch( "wordCountInText" ) );

Change log

Please see CHANGELOG for more information what has changed recently.

Documentation

The data that will be analyzed by YoastSEO.js can be modified by plugins. Plugins can also add new research and assessments. To find out how to do this, checkout out the customization documentation.

Testing

npm test

Generate coverage using the --coverage flag.

Code style

To test your code style:

grunt check

Testing with Yoast SEO

In the YoastSEO.js directory, run:

npm link

Then, in the Yoast SEO directory, assuming you have a complete development version, run:

npm link yoastseo
grunt build:js && grunt build:css

From that point on you need to re-do grunt build:js && grunt build:css when you make changes to YoastSEO.js. If you want to unlink, simply do:

npm unlink yoastseo

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security [at] yoast.com instead of using the issue tracker.

Credits

License

We follow the GPL. Please see License file for more information.

yoastseo.js's People

Contributors

terw-dan avatar atimmer avatar irenestr avatar omarreiss avatar afercia avatar jcomack avatar boblinthorst avatar moorscode avatar rensw90 avatar greenkeeperio-bot avatar nostrabramus avatar diedexx avatar tacoverdo avatar alxy avatar

Watchers

Brad Parks avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.