diff --git a/app/components/head.js b/app/components/head.js
index 9695bb3..3f038c2 100644
--- a/app/components/head.js
+++ b/app/components/head.js
@@ -24,27 +24,25 @@ module.exports = exports = (state, emit) => {
if (state.title !== title) emit(state.events.DOMTITLECHANGE, title);
state.page = state.page || { };
- // TODO:
- // - Support custom metadata (descriptions and whatnot)
+ const newMetadata = state.lbry;
return html`
-
${title}
+ ${newMetadata && newMetadata.title ? newMetadata.title : title}
-
-
+
-
-
-
+
+
+
-
+
diff --git a/app/views/redirect.js b/app/views/redirect.js
index f721e0a..0ac7d63 100644
--- a/app/views/redirect.js
+++ b/app/views/redirect.js
@@ -79,8 +79,19 @@ module.exports = exports = (state, emit) => { // eslint-disable-line
const markdownFileDetails = fm(markdownFile);
const renderedMarkdown = md.render(markdownFileDetails.body);
const updatedMarkdown = partialFinder(renderedMarkdown);
- let newMetadata = "";
- if (markdownFileDetails.attributes.meta) newMetadata = markdownFileDetails.attributes.meta;
+
+ if (markdownFileDetails.attributes.meta) {
+ const customMetadata = {};
+
+ for (const key in markdownFileDetails.attributes.meta) {
+ if (markdownFileDetails.attributes.meta.hasOwnProperty(key)) {
+ customMetadata[Object.keys(markdownFileDetails.attributes.meta[key])[0]] =
+ markdownFileDetails.attributes.meta[key][Object.keys(markdownFileDetails.attributes.meta[key])[0]];
+ }
+ }
+
+ state.lbry = customMetadata;
+ }
let pageScript = "";
if (path === "glossary") pageScript = "";
@@ -101,7 +112,6 @@ module.exports = exports = (state, emit) => { // eslint-disable-line
${raw(updatedMarkdown)}
${raw(pageScript)}
- ${newMetadata.length ? raw(updateMetadata(newMetadata)) : ""}
@@ -112,27 +122,6 @@ module.exports = exports = (state, emit) => { // eslint-disable-line
// H E L P E R S
-function createMetaTags(metaObject) {
- /**
- NOTE:
- For Markdown files, the custom yaml should look like this:
-
- meta:
- - description: Description goes here
-
- This does not currently work with parameters like "og:image"
- // https://github.com/lbryio/lbry.tech/issues/30
- */
-
- let html = "";
-
- for (const metaProperty in metaObject) {
- html += `document.getElementsByTagName("meta")["${metaProperty}"].content = "${metaObject[metaProperty]}";\n`;
- }
-
- return html;
-}
-
function partialFinder(markdownBody) {
const regexToFindPartials = /<\w+\/>/g;
const partials = markdownBody.match(regexToFindPartials);
@@ -157,14 +146,3 @@ function partialFinder(markdownBody) {
return markdownBody;
}
-
-function updateMetadata(metadataDetails) {
- const generatedMetadata = [];
-
- for (const metadataDetail of metadataDetails)
- generatedMetadata.push(createMetaTags(metadataDetail));
-
- return html`
-
- `;
-}