This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
const title = `${document.querySelector('title').textContent}`
|
||||
const dexcription = ` Easy to use online dice rolling with customizable overlays.`
|
||||
function url() {
|
||||
return window.location.protocol + '//' + window.location.hostname + (window.location.port?.length > 0 ? ':' + window.location.port : '');
|
||||
}
|
||||
|
||||
const image = url() + '/rich.png'
|
||||
|
||||
function createMetaTag(name, property, content) {
|
||||
let tag = document.createElement('meta');
|
||||
if (name) {
|
||||
tag.setAttribute('name', name)
|
||||
}
|
||||
if (property) {
|
||||
tag.setAttribute('property', property)
|
||||
}
|
||||
tag.setAttribute('content', content)
|
||||
return tag;
|
||||
}
|
||||
|
||||
function createTags() {
|
||||
return [
|
||||
createMetaTag('description', undefined, dexcription),
|
||||
createMetaTag(undefined, 'og:url', url()),
|
||||
createMetaTag(undefined, 'og:image', image),
|
||||
createMetaTag(undefined, 'og:description', dexcription),
|
||||
createMetaTag(undefined, 'og:title', title),
|
||||
createMetaTag(undefined, 'og:site_name', title),
|
||||
createMetaTag(undefined, 'og:type', 'website'),
|
||||
createMetaTag(undefined, 'twitter:url', url()),
|
||||
createMetaTag(undefined, 'twitter:domain', document.location.hostname),
|
||||
createMetaTag('twitter:title', undefined, title),
|
||||
createMetaTag('twitter:image', undefined, image),
|
||||
createMetaTag('twitter:card', undefined, 'summary_large_image'),
|
||||
createMetaTag('twitter:description', undefined, dexcription),
|
||||
]
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
createTags().forEach(tag => document.head.appendChild(tag))
|
||||
})
|
||||
Reference in New Issue
Block a user