2018-08-29 01:57:18 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-29 18:58:55 +02:00
|
|
|
// P A C K A G E S
|
2018-08-29 01:57:18 +02:00
|
|
|
|
|
|
|
import html from "choo/html";
|
|
|
|
import { require as local } from "app-root-path";
|
|
|
|
|
|
|
|
// V A R I A B L E S
|
|
|
|
|
|
|
|
const config = local("/config");
|
|
|
|
let title = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// E X P O R T
|
|
|
|
|
|
|
|
module.exports = exports = (state, emit) => {
|
2018-09-28 23:34:42 +02:00
|
|
|
switch(true) {
|
|
|
|
case (state.route !== "/" && state.params.wildcard):
|
|
|
|
title = `${state.params.wildcard.capitalize()} ∙ LBRY ∙ ${config.meta.tagline}`;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case (state.route === "api"):
|
|
|
|
title = `API ∙ LBRY ∙ ${config.meta.tagline}`;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
title = `LBRY ∙ ${config.meta.tagline}`;
|
|
|
|
break;
|
|
|
|
}
|
2018-08-29 01:57:18 +02:00
|
|
|
|
|
|
|
if (state.title !== title) emit(state.events.DOMTITLECHANGE, title);
|
|
|
|
state.page = state.page || { };
|
|
|
|
|
2018-09-28 23:20:51 +02:00
|
|
|
const newMetadata = state.lbry;
|
2018-08-29 01:57:18 +02:00
|
|
|
|
|
|
|
return html`
|
|
|
|
<meta charset="utf-8"/>
|
2018-09-28 23:20:51 +02:00
|
|
|
<title>${newMetadata && newMetadata.title ? newMetadata.title : title}</title>
|
2018-08-29 01:57:18 +02:00
|
|
|
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
|
|
|
<meta name="author" content="${config.meta.title}"/>
|
2018-09-28 23:20:51 +02:00
|
|
|
<meta name="description" content="${newMetadata && newMetadata.description ? newMetadata.description : config.meta.description}"/>
|
2018-08-29 01:57:18 +02:00
|
|
|
<meta name="title" content="${config.meta.title}"/>
|
|
|
|
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
|
|
|
|
|
|
|
|
<!--/ Open Graph /-->
|
2018-09-28 23:20:51 +02:00
|
|
|
<meta property="og:image" content="${newMetadata && newMetadata["og:image"] ? newMetadata["og:image"] : "/assets/media/images/og-image.png"}"/>
|
|
|
|
<meta property="og:image:height" content="${newMetadata && newMetadata["og:image:height"] ? newMetadata["og:image:height"] : 720}"/>
|
|
|
|
<meta property="og:image:width" content="${newMetadata && newMetadata["og:image:width"] ? newMetadata["og:image:width"] : 1280}"/>
|
2018-09-27 18:11:26 +02:00
|
|
|
<meta property="og:locale" content="en_US"/>
|
|
|
|
<meta property="og:site_name" content="${config.meta.title}"/>
|
2018-09-28 23:20:51 +02:00
|
|
|
<meta property="og:title" content="${newMetadata && newMetadata.title ? newMetadata.title : title}"/>
|
2018-08-29 01:57:18 +02:00
|
|
|
<meta property="og:type" content="website"/>
|
2018-08-29 18:58:55 +02:00
|
|
|
<meta property="og:url" content="https://lbry.tech${state.href}"/>
|
2018-08-29 01:57:18 +02:00
|
|
|
|
|
|
|
<!--/ Social/App Stuff /-->
|
|
|
|
<meta name="apple-mobile-web-app-title" content="${config.meta.title}"/>
|
|
|
|
<meta name="application-name" content="${config.meta.title}"/>
|
|
|
|
<meta name="msapplication-TileColor" content="${config.meta.color}"/>
|
2018-09-27 18:11:26 +02:00
|
|
|
<meta name="msapplication-TileImage" content="/assets/apple-touch-icon.png"/>
|
2018-08-29 01:57:18 +02:00
|
|
|
<meta name="theme-color" content="${config.meta.color}"/>
|
|
|
|
|
2018-09-27 18:11:26 +02:00
|
|
|
<link rel="apple-touch-icon" href="/assets/apple-touch-icon.png"/>
|
|
|
|
<link rel="icon" href="/assets/favicon.svg" type="image/svg+xml"/>
|
|
|
|
<link rel="mask-icon" href="/assets/favicon.svg" color="${config.meta.color}"/>
|
2018-08-29 01:57:18 +02:00
|
|
|
<link rel="shortcut icon" href="/assets/favicon.ico"/>
|
2018-09-27 18:11:26 +02:00
|
|
|
<link rel="stylesheet" href="/assets/bundle.css"/>
|
2018-08-29 01:57:18 +02:00
|
|
|
|
|
|
|
<script src="/assets/scripts/sockets.js"></script>
|
|
|
|
`;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// H E L P E R
|
|
|
|
|
|
|
|
String.prototype.capitalize = function () {
|
|
|
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
|
|
};
|