Commit 7b9bb5a3 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Add missing OpenGraph informations to HTML head of pages.

parent bd6c7a43
......@@ -8,15 +8,19 @@
<meta charset="utf-8">
<meta name="fragment" content="!">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<meta property="og:type" content="website">
<meta property="og:site_name" content="OGP Toolbox">
<title>OGP Toolbox</title>
<meta property="og:image" content="">
<meta property="og:site_name" content="OGP Toolbox">
<meta property="og:title" content="OGP Toolbox">
<meta property="og:type" content="website">
<meta property="og:url" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<!--<link rel="apple-touch-icon" href="apple-touch-icon.png">-->
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,400i,700" rel="stylesheet">
</head>
<body>
......
......@@ -7,15 +7,19 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<meta property="og:type" content="website">
<meta property="og:site_name" content="OGP Toolbox">
<title>OGP Toolbox</title>
<meta property="og:image" content="">
<meta property="og:site_name" content="OGP Toolbox">
<meta property="og:title" content="OGP Toolbox">
<meta property="og:type" content="website">
<meta property="og:url" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<!--<link rel="apple-touch-icon" href="apple-touch-icon.png">-->
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,400i,700" rel="stylesheet">
</head>
<body>
......
......@@ -47,16 +47,27 @@ main.ports.setDocumentMetatags.subscribe(function(metatags) {
element.setAttribute('content', metatags.imageUrl);
}
}
if (metatags.hasOwnProperty('title')) {
var genericTitle = "OGP Toolbox";
var title = metatags.title + "" + genericTitle;
var element = document.head.querySelector('meta[property="og:title"]');
if (element) {
element.setAttribute('content', title);
}
var elements = document.head.getElementsByTagName('title');
if (elements.length) {
var element = elements[0];
var genericTitle = "OGP Toolbox";
element.innerText = metatags.title
? metatags.title + "" + genericTitle
: genericTitle;
element.innerText = title;
}
}
var element = document.head.querySelector('meta[property="og:url"]');
if (element) {
element.setAttribute('content', window.location.href);
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment