Dynamically add seo meta tags using jquery

    Here it the example how you can do this

    //MAKING TITLE DYNAMIC
    let newUrlAfterSplit = [];
    let filteredUrl = '';
    let finalUrl = '';
    let url = window.location + '';
    
    newUrlAfterSplit = url.split('/');
    filteredUrl = newUrlAfterSplit.filter(function (e) {
        return e
    });
    finalUrl = filteredUrl[filteredUrl.length - 1].replace(/-/g, ' ');
    document.title = 'websitename | ' + finalUrl.replace(/(^\w{1})|(\s{1}\w{1})/g, match => match.toUpperCase());
    
    //Dynaically adding page discription
    let description = '';
    let newDescription = '';
    //removing white space and charecters
    description = $(".pageIntroDescription").text().trim().replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-');
    //removing html tags
    newDescription = description.replace(/(<([^>]+)>)/ig, "");
    
    $('meta[property="og:description"]').attr('content', newDescription);
    $('meta[name=description]').attr('content', newDescription);
    
    
    //Adding Url meta
    $('meta[property="og:url"]').attr('content',window.location);
    $('meta[name=url]').attr('content', window.location);
    
    


    Dynamically adding page description just create a div with class of

    'pageIntroDescription'.