diff --git a/src/main/resources/META-INF/resources/rich-preview.js b/src/main/resources/META-INF/resources/rich-preview.js deleted file mode 100644 index 13000c3..0000000 --- a/src/main/resources/META-INF/resources/rich-preview.js +++ /dev/null @@ -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)) -}) diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 11ac30e..00399d2 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -12,8 +12,21 @@ - + + + + + + + + + + + + + +