Monday, 3 June 2019

how to add Yoast wordpress plugin to laravel

I develop a website with Laravel and now I'd like to add Yoast plugin to it's blogger section to improve site blogs.
as I can see from Yoast github there is a javascript version of it that can be add to custom sites.
the usage help is not very helpful, 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 ) );
};

the usage help is with node.js but how can I add it to php backend and html+js front end.
thanks you.



from how to add Yoast wordpress plugin to laravel

No comments:

Post a Comment