lbry.tech/app/components/head.js

79 lines
2.8 KiB
JavaScript
Raw Normal View History

2018-08-29 01:57:18 +02:00
"use strict";
2019-01-30 00:29:14 +01:00
// I M P O R T
2018-08-29 01:57:18 +02:00
import html from "choo/html";
2019-02-15 18:40:10 +01:00
// U T I L
2018-08-29 01:57:18 +02:00
import config from "~root/config";
2018-08-29 01:57:18 +02:00
2019-02-15 18:40:10 +01:00
2018-08-29 01:57:18 +02:00
// E X P O R T
2018-10-03 23:13:31 +02:00
export default (state, emit) => {
2019-02-15 17:50:56 +01:00
const newMetadata = state.lbry;
2019-04-12 21:08:35 +02:00
const description = newMetadata && newMetadata.description ?
newMetadata.description :
config.meta.description;
const title = newMetadata && newMetadata.title ?
newMetadata.title + " - lbry.tech" :
"lbry.tech - " + config.meta.tagline;
if (state.title !== title)
emit(state.events.DOMTITLECHANGE, title);
2018-08-29 01:57:18 +02:00
state.page = state.page || { };
return html`
<meta charset="utf-8"/>
2019-02-15 17:50:56 +01:00
<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}"/>
2019-02-15 17:50:56 +01:00
<meta name="description" content="${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 /-->
2019-02-15 17:50:56 +01:00
<meta property="og:title" content="${title}"/>
<meta property="og:description" content="${description}"/>
<meta property="og:image" content="${newMetadata && newMetadata["og:image"] ? newMetadata["og:image"] : "/assets/media/images/og-image.png"}"/>
2019-04-16 01:12:44 +02:00
<meta property="og:image:height" content="${newMetadata && newMetadata["og:image:height"] ? newMetadata["og:image:height"] : 1125}"/>
<meta property="og:image:width" content="${newMetadata && newMetadata["og:image:width"] ? newMetadata["og:image:width"] : 2000}"/>
2018-09-27 18:11:26 +02:00
<meta property="og:locale" content="en_US"/>
2019-02-15 17:50:56 +01:00
<meta property="og:site_name" content="LBRY.tech"/>
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"/>
2019-02-07 22:17:30 +01:00
<link rel="stylesheet" href="https://rsms.me/inter/inter.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/tonsky/FiraCode@master/distr/fira_code.css"/>
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
2018-10-06 22:53:01 +02:00
String.prototype.capitalize = function() {
2018-08-29 01:57:18 +02:00
return this.charAt(0).toUpperCase() + this.slice(1);
};