mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-24 08:21:29 +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 Actions = require('homebrewery/brew.actions.js');
|
||||||
const Store = require('homebrewery/brew.store.js');
|
const Store = require('homebrewery/brew.store.js');
|
||||||
|
|
||||||
|
const Headtags = require('vitreum/headtags');
|
||||||
|
|
||||||
const SharePage = React.createClass({
|
const SharePage = React.createClass({
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
@@ -39,9 +41,28 @@ const SharePage = React.createClass({
|
|||||||
p : Actions.print
|
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(){
|
render : function(){
|
||||||
const brew = Store.getBrew();
|
const brew = Store.getBrew();
|
||||||
return <div className='sharePage page'>
|
return <div className='sharePage page'>
|
||||||
|
{this.renderMetatags(brew)}
|
||||||
|
|
||||||
<Navbar>
|
<Navbar>
|
||||||
<Nav.section>
|
<Nav.section>
|
||||||
<Nav.item className='brewTitle'>{brew.title}</Nav.item>
|
<Nav.item className='brewTitle'>{brew.title}</Nav.item>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const BrewSchema = mongoose.Schema({
|
|||||||
title : {type : String, default : ""},
|
title : {type : String, default : ""},
|
||||||
description : {type : String, default : ""},
|
description : {type : String, default : ""},
|
||||||
tags : {type : String, default : ""},
|
tags : {type : String, default : ""},
|
||||||
|
thumbnail : {type : String, default : ""},
|
||||||
systems : [String],
|
systems : [String],
|
||||||
authors : [String],
|
authors : [String],
|
||||||
published : {type : Boolean, default : false},
|
published : {type : Boolean, default : false},
|
||||||
|
|||||||
@@ -139,13 +139,12 @@ const MetadataEditor = React.createClass({
|
|||||||
<textarea value={this.props.metadata.description} className='value'
|
<textarea value={this.props.metadata.description} className='value'
|
||||||
onChange={this.handleFieldChange.bind(null, 'description')} />
|
onChange={this.handleFieldChange.bind(null, 'description')} />
|
||||||
</div>
|
</div>
|
||||||
{/*}
|
<div className='field thumbnail'>
|
||||||
<div className='field tags'>
|
<label>thumbnail</label>
|
||||||
<label>tags</label>
|
<input type='text' className='value'
|
||||||
<textarea value={this.props.metadata.tags}
|
value={this.props.metadata.thumbnail}
|
||||||
onChange={this.handleFieldChange.bind(null, 'tags')} />
|
onChange={this.handleFieldChange.bind(null, 'thumbnail')} />
|
||||||
</div>
|
</div>
|
||||||
*/}
|
|
||||||
|
|
||||||
<div className='field systems'>
|
<div className='field systems'>
|
||||||
<label>systems</label>
|
<label>systems</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user