Merge pull request #257 from lbryio/metadata

add metadata, fix metadata
This commit is contained in:
netop:// ウェッブ 2019-02-15 11:47:02 -06:00 committed by GitHub
commit b0f30bf33c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 85 additions and 45 deletions

View file

@ -6,52 +6,40 @@
import html from "choo/html";
// U T I L S
// U T I L
import config from "@root/config";
let title = "";
// E X P O R T
export default (state, emit) => {
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;
}
const newMetadata = state.lbry;
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);
state.page = state.page || { };
const newMetadata = state.lbry;
return html`
<meta charset="utf-8"/>
<title>${newMetadata && newMetadata.title ? newMetadata.title : title}</title>
<title>${title}</title>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="author" content="${config.meta.title}"/>
<meta name="description" content="${newMetadata && newMetadata.description ? newMetadata.description : config.meta.description}"/>
<meta name="description" content="${description}"/>
<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 /-->
<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"}"/>
<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}"/>
<meta property="og:locale" content="en_US"/>
<meta property="og:site_name" content="${config.meta.title}"/>
<meta property="og:title" content="${newMetadata && newMetadata.title ? newMetadata.title : title}"/>
<meta property="og:site_name" content="LBRY.tech"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="https://lbry.tech${state.href}"/>

View file

@ -25,13 +25,13 @@ const sdkApi = process.env.NODE_ENV === "development" ?
// E X P O R T
export default async(state) => {
// How to set custom metadata for this page
// state.lbry = {
// description: "This is the API page for LBRY.tech",
// "og:image": "/assets/media/images/carlsagan2.jpg",
// "og:image:height": 300,
// "og:image:width": 400
// };
// below is evil, I just inherited it -- Jeremy
const apilabel = state.params.wildcard == "sdk" ? "SDK" : state.params.wildcard.charAt(0).toLocaleUpperCase() + state.params.wildcard.substring(1);
state.lbry = {
title: apilabel + " API Documentation",
description: "See API documentation, signatures, and sample calls for the LBRY " + apilabel + " APIs."
};
try {
const apiResponse = await parseApiFile(state.params.wildcard);

View file

@ -30,6 +30,8 @@ export default (state, emit) => { // eslint-disable-line
const markdownFile = fs.readFileSync(path, "utf-8");
const markdownFileDetails = fm(markdownFile);
const title = markdownFileDetails.attributes.title;
const description = markdownFileDetails.attributes.description || "";
if (markdownFileDetails.attributes.meta) {
const customMetadata = {};
@ -41,10 +43,16 @@ export default (state, emit) => { // eslint-disable-line
}
}
// below seems evil
state.lbry = customMetadata;
}
// below is evil, I just inherited it -- Jeremy
state.lbry = {
title: title,
description: description
};
// below should be refactored into components
let pageScript = "";
@ -71,7 +79,7 @@ export default (state, emit) => { // eslint-disable-line
<header class="page__header">
<div class="page__header-wrap">
<div class="inner-wrap">
<h1 class="page__header__title" itemprop="name headline">${markdownFileDetails.attributes.title}</h1>
<h1 class="page__header__title" itemprop="name headline">${title}</h1>
</div>
</div>
</header>

View file

@ -13,7 +13,7 @@ module.exports = exports = {
},
meta: {
color: "#222",
description: "LBRY is a free, open, and community-run digital marketplace. Come check out our documentation and contribute!",
description: "LBRY is a free, open, and community-controlled digital goods marketplace. Learn about technical specifics, how to contribute, API specifications, and much more.",
name: "LBRY",
tagline: "We came from the future to help you save the Internet",
title: "LBRY"

View file

@ -1,5 +1,6 @@
---
title: Build
description: Learn how to build your own app via LBRY in this comprehensive guide! The future of content freedom begins with you. *patriotic music plays*
---
## THIS IS NOT DONE AT ALL AND IF YOU CONTINUE TO READ IT YOU MENTALLY ASSENT TO COMMITTING AT LEAST ONE CHANGE THAT MAKES IT BETTER

View file

@ -1,5 +1,6 @@
---
title: Community
description: Want to talk with other LBRYians? Find out where the LBRY team hangs out. It's not _only_ shady street corners.
---
Sometimes we say that the LBRY [[blockchain]] is the foundation of the LBRY protocol, but that's not really true. The foundation of LBRY is the community of people that make it possible.

View file

@ -1,5 +1,6 @@
---
title: Contributor's Guide
description: Learn how to be a contributor to core and auxiliary LBRY components in this guide. Everything LBRY builds is open-source, be a part of it!
---
## Welcome to LBRY!

View file

@ -1,5 +1,6 @@
---
title: LBRY Glossary
title: Glossary
description: lbry.tech sometimes uses acronyms and fancy words. This glossary converts our jargon into clarity.
---
This glossary will help you understand the exact meaning of LBRY and blockchain related terms.

View file

@ -1,5 +1,6 @@
---
title: Overview
description: What *is* LBRY? Who *is* Satoshi? In this LBRY technology overview, one of those questions is answered thoroughly.
---
## Mission

View file

@ -1,5 +1,6 @@
---
title: Playground
description: Learn by doing? In this interactive playground you can use the LBRY network and get a feeling for how it actually works!
---
Check out any of the interactive examples to get a feel for the LBRY protocol!

View file

@ -1,5 +1,6 @@
---
title: Resources
description: Find the LBRY specification, API documentation, our Contributor's guide, and more in the Resources area.
---
<ResourcesLinkGrid/>

View file

@ -1,4 +1,7 @@
# API wrappers for the LBRY blockchain and protocol
---
title: API Wrappers
description: Find LBRY API wrappers for your favorite language.
---
This document contains a comprehensive list of all available API wrappers for the LBRY protocol and blockchain. API wrappers allow for easier integration of the LBRY APIs into your codebase. They still require you to run either the [LBRY protocol](https://github.com/lbryio/lbry) or the [LBRY blockchain](https://github.com/lbryio/lbrycrd).

View file

@ -1,4 +1,7 @@
# Signing a claim
---
title: Claim Signing
description: How does signing a claim (a publish) work in LBRY-land? This page explains in great detail. Seriously great detail. The greatest detail anyone has ever seen!
---
Reilly wants to publish _Terror on the Midway_ to the channel he claimed `lbry://@FleischerSuperman`. He picks the name "terroronthemidway", and fills in the information for the claim:

View file

@ -1,4 +1,7 @@
# The Merkle Claim Trie
---
title: Merkle Claim Trie
description: Publishes to the LBRY network get placed into a Merkle Claim Trie. Learn what that is and why trie is not a typo in this resource article.
---
How the data structure that organizes claims by names works, how proofs are generated/verified and how consensus on the state of the trie is represented.

View file

@ -1,4 +1,7 @@
# LBRY Consensus Algorithm
---
title: Consensus Algorithm
description: How does the LBRY blockchain achieve consensus? This resource page will explain.
---
LBRY uses [proof of work](https://en.bitcoin.it/wiki/Proof_of_work) as a consensus mechanism, the same way that Bitcoin does.

View file

@ -1,6 +1,9 @@
# Configurable settings for the LBRY daemon
---
title: SDK Settings
description: The daemon provided by the LBRY SDK has many settings. This resource lists them all and what they mean. Ready, set, settings!
---
This document outlines how to configure daemon settings and what options are available. They can be found on the lbry GitHub repository in [conf.py](https://github.com/lbryio/lbry/blob/master/lbrynet/conf.py).
This document outlines how to configure SDK daemon settings and what options are available. They can be found on the lbry GitHub repository in [conf.py](https://github.com/lbryio/lbry/blob/master/lbrynet/conf.py).
## Daemon settings configuration

View file

@ -1,8 +1,13 @@
# How To Download Content Using LBRY
---
title: Content Downloading
description: This resource article walks through the step-by-step process of downloading a piece of content from the LBRY network.
---
This resource outlines the step-by-step process of using the LBRY protocol to download something.
## Getting Started
This is the step-by-step process of using LBRY to download something. It spans the three core components of LBRY (blockchain, DHT, blob exchange) and explains the structure of the claim metadata and the blobs that make up a stream.
Downloading spans the three core components of LBRY (blockchain, DHT, blob exchange) and explains the structure of the claim metadata and the blobs that make up a stream.
You will need:

View file

@ -1,8 +1,13 @@
# How To Download Content Using the LBRY Protocol
---
title: Content Downloading
description: This resource article walks through the step-by-step process of downloading a piece of content from the LBRY network.
---
This resource outlines the step-by-step process of using the LBRY protocol to download something.
## Getting Started
This is the step-by-step process of using the LBRY protocol to download something. It spans the three core components of LBRY (blockchain, DHT, blob exchange) and explains the structure of the claim metadata and the blobs that make up a LBRY stream.
Downloading spans the three core components of LBRY (blockchain, DHT, blob exchange) and explains the structure of the claim metadata and the blobs that make up a LBRY stream.
You will need:

View file

@ -1,3 +1,8 @@
---
title: Full Node Encryption
description: Learn how to use encryption with lbrycrd, the full blockchain software for the LBRY network.
---
*Note: The below instructions are the [LBRYCrd Full Blockchain wallet](https://github.com/lbryio/lbrycrd) and not the default wallet that ships with the LBRY App. We are still working on an encryption solution for this.*
You can use `lbrycrd-cli encryptwallet <passphrase>` to encrypt your wallet.

View file

@ -1,6 +1,10 @@
# Regtest Setup
---
title: Regtest Setup
description: Regtest is a parallel testing network for the LBRY blockchain. Learn how to use it in this resource article.
---
## Why Use Regtest
## Why use a regtest server
A regtest server provides for a way to instantly generate blocks so that transactions can be instantaneous, which ultimately means no waiting for confirmations from the blockchain. Also, its not a problem if you accidentally corrupt your wallet, since no real funds are lost! Delete the files and setup a new one.
## Setup

View file

@ -1,4 +1,7 @@
# LBRY Repository Documentation Standards
---
title: Repository Documentation Standards
description: All repository documentation at LBRY complies with a single standard, outlined in this resource article.
---
This document outlines the standards for all public, open-source repositories used by LBRY.