mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-13 03:35:56 +00:00
Added support for title description and thumbnail images
This commit is contained in:
@@ -15,6 +15,8 @@ const Utils = require('homebrewery/utils.js');
|
||||
const Actions = require('homebrewery/brew.actions.js');
|
||||
const Store = require('homebrewery/brew.store.js');
|
||||
|
||||
const Headtags = require('vitreum/headtags');
|
||||
|
||||
const SharePage = React.createClass({
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
@@ -39,9 +41,28 @@ const SharePage = React.createClass({
|
||||
p : Actions.print
|
||||
}),
|
||||
|
||||
renderMetatags : function(brew){
|
||||
let metatags = [
|
||||
<Headtags.meta key='site_name' property='og:site_name' content='Homebrewery'/>,
|
||||
<Headtags.meta key='type' property='og:type' content='article' />
|
||||
];
|
||||
if(brew.title){
|
||||
metatags.push(<Headtags.meta key='title' property='og:title' content={brew.title} />);
|
||||
}
|
||||
if(brew.description){
|
||||
metatags.push(<Headtags.meta key='description' name='description' content={brew.description} />);
|
||||
}
|
||||
if(brew.thumbnail){
|
||||
metatags.push(<Headtags.meta key='image' property='og:image' content={brew.thumbnail} />);
|
||||
}
|
||||
return metatags;
|
||||
},
|
||||
|
||||
render : function(){
|
||||
const brew = Store.getBrew();
|
||||
return <div className='sharePage page'>
|
||||
{this.renderMetatags(brew)}
|
||||
|
||||
<Navbar>
|
||||
<Nav.section>
|
||||
<Nav.item className='brewTitle'>{brew.title}</Nav.item>
|
||||
|
||||
@@ -14,6 +14,7 @@ const BrewSchema = mongoose.Schema({
|
||||
title : {type : String, default : ""},
|
||||
description : {type : String, default : ""},
|
||||
tags : {type : String, default : ""},
|
||||
thumbnail : {type : String, default : ""},
|
||||
systems : [String],
|
||||
authors : [String],
|
||||
published : {type : Boolean, default : false},
|
||||
|
||||
@@ -139,13 +139,12 @@ const MetadataEditor = React.createClass({
|
||||
<textarea value={this.props.metadata.description} className='value'
|
||||
onChange={this.handleFieldChange.bind(null, 'description')} />
|
||||
</div>
|
||||
{/*}
|
||||
<div className='field tags'>
|
||||
<label>tags</label>
|
||||
<textarea value={this.props.metadata.tags}
|
||||
onChange={this.handleFieldChange.bind(null, 'tags')} />
|
||||
<div className='field thumbnail'>
|
||||
<label>thumbnail</label>
|
||||
<input type='text' className='value'
|
||||
value={this.props.metadata.thumbnail}
|
||||
onChange={this.handleFieldChange.bind(null, 'thumbnail')} />
|
||||
</div>
|
||||
*/}
|
||||
|
||||
<div className='field systems'>
|
||||
<label>systems</label>
|
||||
|
||||
Reference in New Issue
Block a user