How to add WordPress Yoast plugin to laravel

I am developing a website using Laravel, and now I would like to add the Yoast plugin to the blog section to improve the site’s blogs.
as I see from Yoast GitHub, there is a version of Javascript that can be added to user sites.
Help for use is not very useful, so if any body can help me.

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 ) );
};

help for use - with node.js, but how can I add it to the php backend and html + js front end?
Thanks you.

+15
source share
1 answer

- . nodejs javascript , browserify.

  npm install -g browserify

   npm install <module_name>

JS

   browserify <main.js> -o  <destination.js>

HTML,

   <script src="destination.js"></script>

YOAST, , browserify. browserify index.js HTML , .

+11

Source: https://habr.com/ru/post/1665449/


All Articles