forked from danascript/algtivism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
21 lines (18 loc) · 852 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const getSeoData = () => {
const pageTitle = document.title
const pageUrl = document.URL
const pageDescription = document.querySelector('meta[name="description"]').content
const pageImg = document.querySelectorAll('img')[0].src
setOgSeoData({ pageTitle, pageUrl, pageDescription, pageImg })
}
const setOgSeoData = ({ pageTitle, pageUrl, pageDescription, pageImg }) => {
document.querySelector('meta[property="og:url"]').content = pageUrl
document.querySelector('meta[property="og:title"]').content = pageTitle
document.querySelector('meta[property="og:site_name"]').content = pageTitle
document.querySelector('meta[property="og:description"]').content = pageDescription
document.querySelector('meta[property="og:image"]').content = pageImg
}
getSeoData()
/*
* Add here any JavaScript you want to use
*/