From fe286870a3bc5871c400e69719d11c22134b0a4a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 15:34:22 -0400 Subject: [PATCH 1/4] closed #116 --- public/templates/admin/settings.tpl | 4 +++- src/webserver.js | 35 +++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/public/templates/admin/settings.tpl b/public/templates/admin/settings.tpl index 7697fc9b39..82fce61327 100644 --- a/public/templates/admin/settings.tpl +++ b/public/templates/admin/settings.tpl @@ -5,7 +5,9 @@
- + + +
diff --git a/src/webserver.js b/src/webserver.js index e4fe86b413..fd25cab38d 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -34,7 +34,8 @@ var express = require('express'), var defaultMetaTags = [ { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }, { name: 'content-type', content: 'text/html; charset=UTF-8' }, - { name: 'apple-mobile-web-app-capable', content: 'yes' } + { name: 'apple-mobile-web-app-capable', content: 'yes' }, + { property: 'og:site_name', content: global.config.title || 'NodeBB' }, ], metaString = utils.buildMetaTags(defaultMetaTags.concat(options.metaTags || [])), templateValues = { @@ -175,7 +176,16 @@ var express = require('express'), app.get('/', function(req, res) { async.parallel({ "header": function(next) { - app.build_header({ req: req, res: res }, next); + app.build_header({ + req: req, + res: res, + metaTags: [ + { name: "title", content: global.config.title || 'NodeBB' }, + { name: "description", content: global.config.description || '' }, + { property: 'og:title', content: 'Index | ' + (global.config.title || 'NodeBB') }, + { property: "og:type", content: 'website' } + ] + }, next); }, "categories": function(next) { categories.getAllCategories(function(returnData) { @@ -214,12 +224,28 @@ var express = require('express'), }); }, function(topicData, next) { + var posts = topicData.posts.push(topicData.main_posts[0]), + authors = [], + lastMod = 0, + timestamp; + for(var x=0,numPosts=topicData.posts.length;x lastMod) lastMod = timestamp; + if (authors.indexOf(topicData.posts[x].username) === -1) authors.push(topicData.posts[x].username); + } + app.build_header({ req: req, res: res, title: topicData.topic_name, metaTags: [ - { name: "title", content: topicData.topic_name } + { name: "title", content: topicData.topic_name }, + { property: 'og:title', content: topicData.topic_name }, + { property: "og:type", content: 'article' }, + { property: "article:published_time", content: new Date(parseInt(topicData.main_posts[0].timestamp, 10)).toISOString() }, + { property: 'article:modified_time', content: new Date(lastMod).toISOString() }, + { property: 'article:author', content: authors.join(',') }, + { property: 'article:section', content: topicData.category_name } ] }, function(err, header) { next(err, { @@ -269,7 +295,8 @@ var express = require('express'), title: categoryData.category_name, metaTags: [ { name: 'title', content: categoryData.category_name }, - { name: 'description', content: categoryData.category_description } + { name: 'description', content: categoryData.category_description }, + { property: "og:type", content: 'website' } ] }, function(err, header) { next(err, { From 7dbf18c1d0963acc00755e8704600cddfd7fe36b Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 15:44:54 -0400 Subject: [PATCH 2/4] removing authors from OG tags --- src/webserver.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/webserver.js b/src/webserver.js index fd25cab38d..c2963689f2 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -225,13 +225,11 @@ var express = require('express'), }, function(topicData, next) { var posts = topicData.posts.push(topicData.main_posts[0]), - authors = [], lastMod = 0, timestamp; for(var x=0,numPosts=topicData.posts.length;x lastMod) lastMod = timestamp; - if (authors.indexOf(topicData.posts[x].username) === -1) authors.push(topicData.posts[x].username); } app.build_header({ @@ -244,7 +242,6 @@ var express = require('express'), { property: "og:type", content: 'article' }, { property: "article:published_time", content: new Date(parseInt(topicData.main_posts[0].timestamp, 10)).toISOString() }, { property: 'article:modified_time', content: new Date(lastMod).toISOString() }, - { property: 'article:author', content: authors.join(',') }, { property: 'article:section', content: topicData.category_name } ] }, function(err, header) { From cb8c8f9e421651b9ed8fa2a1dceb94464a0e9cbe Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 15:49:55 -0400 Subject: [PATCH 3/4] tweaked OG tags for topics --- src/webserver.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/webserver.js b/src/webserver.js index c2963689f2..1e581c150c 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -238,8 +238,10 @@ var express = require('express'), title: topicData.topic_name, metaTags: [ { name: "title", content: topicData.topic_name }, - { property: 'og:title', content: topicData.topic_name }, + { property: 'og:title', content: topicData.topic_name + ' | ' + (global.config.title || 'NodeBB') }, { property: "og:type", content: 'article' }, + { property: "og:url", content: global.nconf.get('url') + 'topic/' + topicData.slug }, + { property: 'og:image', content: topicData.main_posts[0].picture }, { property: "article:published_time", content: new Date(parseInt(topicData.main_posts[0].timestamp, 10)).toISOString() }, { property: 'article:modified_time', content: new Date(lastMod).toISOString() }, { property: 'article:section', content: topicData.category_name } From eabba1cc1f0ef91b01cb635faecb067a770d965a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 15:53:25 -0400 Subject: [PATCH 4/4] swapped position of reply/quote button in main post in topic (#95) --- public/templates/topic.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 5c3f1fb397..93f04aa4f1 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -48,8 +48,8 @@
- +