testing OGP

This commit is contained in:
ferricles 2022-01-14 00:52:54 -05:00
parent 63d85cc40e
commit c0b0231b4d
3 changed files with 17 additions and 1 deletions

View file

@ -1,11 +1,18 @@
<!DOCTYPE html>
<html scroll-behavior="smooth">
<html scroll-behavior="smooth" prefix="og: https://ogp.me/ns#">
<head>
<meta charset="UTF-8" />
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width, user-scalable=no" />
<!--OGP suite-->
<meta property="og:title" content="Wynnbuilder" />
<meta property="og:type" content="image" />
<meta property="og:url" id = "ogp-url" content="" />
<meta property="og:image" content="https://i.kym-cdn.com/entries/icons/original/000/037/349/Screenshot_14.jpg" />
<!-- nunito font, copying wynndata -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet">

View file

@ -1076,3 +1076,4 @@ function init2() {
load_ing_init(init);
}
load_init(init2);
updateOGP();

View file

@ -3,6 +3,14 @@ const url_base = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.sp
const zip = (a, b) => a.map((k, i) => [k, b[i]]);
//updates all the OGP tags for a webpage. Should be called when build changes
function updateOGP() {
let url_elem = document.getElementById("ogp-url");
if (url_elem) {
url_elem.content = url_base + getUrl;
}
}
function clamp(num, low, high){
return Math.min(Math.max(num, low), high);
}