Sha256: 06fab73596f5eb704b2360300f33e2c35c4b217e0f109e778692e30a3d98a48c

Contents?: true

Size: 1.32 KB

Versions: 262

Compression:

Stored size: 1.32 KB

Contents

let script = document.currentScript
const params = new URLSearchParams(window.location.search)
let type = params.get('fileName')
let jsonFileName = atob(type);
let folderName = script.dataset.foldername
let fileName = jsonFileName
let lang = script.dataset.lang

let home_h1 = document.querySelector(".home-top-h1")
let home_h2 = document.querySelector(".home-top-h2")
let home_img = document.querySelector(".home-img")

const getSeodata = async () => {
    let URL = '/data' + '/' + folderName + '/' + lang + '/' + fileName + '.json'
    const data = await fetch(URL)
    const seoData = await data.json()

    home_h1.innerHTML = seoData.h1
    home_h2.innerHTML = seoData.h2

    document.head.querySelector('meta[property="og:title"]').setAttribute("content", seoData.TITLE);
    document.head.querySelector('meta[name="description"]').setAttribute("content", seoData.META);
    document.head.querySelector('meta[name="twitter:title"]').setAttribute("content", seoData.TITLE);
    document.head.querySelector('meta[name="twitter:description"]').setAttribute("content", seoData.META);


    if (seoData.img) {
        home_img.src = seoData.img
        home_img.setAttribute("alt", seoData.imgalt)
        home_img.style.width = seoData.imgwidth
        home_img.style.height = seoData.imgheight
    }

    document.title = seoData.TITLE

}
getSeodata()

Version data entries

262 entries across 262 versions & 1 rubygems

Version Path
appscms-tools-theme-1.9.2 assets/js/homeResult.js
appscms-tools-theme-1.9.1 assets/js/homeResult.js