From 4a962f9a9b6afbd489a04926a725e636d7b77afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=AB=20=E3=82=A6=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=96?= Date: Wed, 25 Jul 2018 15:42:29 -0500 Subject: [PATCH] Metadata is setup --- config.js | 9 ++++- views/components/html.js | 22 ++++++------ views/pages/tour.js | 2 +- views/partials/head.js | 74 +++++++++++++++++++++++----------------- 4 files changed, 61 insertions(+), 46 deletions(-) diff --git a/config.js b/config.js index 0d02f8f..98c4341 100644 --- a/config.js +++ b/config.js @@ -3,10 +3,17 @@ module.exports = exports = { + ga: "UA-60403362-1", github: { branch: "new", linkText: "Edit this page on GitHub", repo: "lbryio/lbry.tech" }, - ga: "UA-60403362-1" + meta: { + color: "#222", + description: "LBRY is a free, open, and community-run digital marketplace. Come check out our documentation and contribute!", + name: "LBRY", + tagline: "We came from the future to help you save the Internet", + title: "LBRY" + } }; diff --git a/views/components/html.js b/views/components/html.js index c54c31d..5f464b5 100755 --- a/views/components/html.js +++ b/views/components/html.js @@ -10,17 +10,15 @@ const html = require("choo-async/html"); // E X P O R T -module.exports = exports = (head, body) => { - return (state, emit) => { - const bodyPromise = Promise.resolve(body(state, emit)); - const headPromise = bodyPromise.then(() => head(state, emit)); // resolve `head` once `body` is resolved +module.exports = exports = (head, body) => (state, emit) => { + const bodyPromise = Promise.resolve(body(state, emit)); + const headPromise = bodyPromise.then(() => head(state, emit)); // resolve `head` once `body` is resolved - return html` - - - ${headPromise} - ${bodyPromise} - - `; - }; + return html` + + + ${headPromise} + ${bodyPromise} + + `; }; diff --git a/views/pages/tour.js b/views/pages/tour.js index 24ffcab..67e98b1 100644 --- a/views/pages/tour.js +++ b/views/pages/tour.js @@ -302,7 +302,7 @@ function step2() { function step3() { /** - Step 2 loading steps: + Step 3 loading steps: - exampleCode !== ''
diff --git a/views/partials/head.js b/views/partials/head.js index 7581de8..1ebce2c 100755 --- a/views/partials/head.js +++ b/views/partials/head.js @@ -2,48 +2,58 @@ -// P A C K A G E +// P A C K A G E S const html = require("choo-async/html"); +const local = require("app-root-path").require; + +// V A R I A B L E + +const config = local("/config"); // E X P O R T -module.exports = exports = () => async () => html`${[ - html``, - html`LBRY · tagline`, +module.exports = exports = () => async (state) => { + let pageTitle = ""; - html``, - html``, - html``, - html``, - html``, + if (state.route && state.route !== "/" && state.route !== "*") pageTitle = state.route.charAt(0).toUpperCase() + state.route.slice(1); + if (state.params.wildcard) pageTitle = state.params.wildcard.charAt(0).toUpperCase() + state.params.wildcard.slice(1); - // Open Graph - html``, - html``, - html``, - html``, - html``, - html``, + return html`${[ + html``, + html`${pageTitle.length ? pageTitle + " | " : ""}${config.meta.title} · ${config.meta.tagline}`, - // Social/App Stuff - html``, - html``, - html``, - html``, - html``, - html``, + html``, + html``, + html``, + html``, + html``, - html``, - html``, - html``, - html``, + // Open Graph + html``, + html``, + html``, + html``, + html``, + html``, - html``, - html``, - html`` -]}`; + // Social/App Stuff + html``, + html``, + html``, + html``, + html``, + html``, -// TODO: Update meta details + html``, + html``, + html``, + html``, + + html``, + html``, + html`` + ]}`; +};