mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-23 17:00:24 +01:00
This commit is contained in:
@@ -107,6 +107,23 @@
|
||||
return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
|
||||
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
|
||||
});
|
||||
},
|
||||
|
||||
buildMetaTags: function(tagsArr) {
|
||||
var tags = '',
|
||||
tag;
|
||||
for(var x=0,numTags=tagsArr.length;x<numTags;x++) {
|
||||
if (tags.length > 0) tags += "\n\t";
|
||||
tag = '<meta';
|
||||
for(y in tagsArr[x]) {
|
||||
tag += ' ' + y + '="' + tagsArr[x][y] + '"';
|
||||
}
|
||||
tag += ' />';
|
||||
|
||||
tags += tag;
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="title" CONTENT="NodeBB">
|
||||
<meta name="keywords" content="" />
|
||||
<meta name="description" content="{meta.description}" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
{meta_tags}
|
||||
<link href="{cssSrc}" rel="stylesheet" media="screen">
|
||||
<link href="{relative_path}/vendor/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
|
||||
<link rel="stylesheet" href="{relative_path}/vendor/fontawesome/css/font-awesome.min.css">
|
||||
|
||||
@@ -13,7 +13,8 @@ var RDB = require('./redis.js'),
|
||||
if (err) return callback(err);
|
||||
|
||||
var category_name = categoryData.name,
|
||||
category_slug = categoryData.slug;
|
||||
category_slug = categoryData.slug,
|
||||
category_description = categoryData.description;
|
||||
|
||||
function getTopicIds(next) {
|
||||
Categories.getTopicIds(category_id, next);
|
||||
@@ -28,6 +29,7 @@ var RDB = require('./redis.js'),
|
||||
|
||||
var categoryData = {
|
||||
'category_name' : category_name,
|
||||
'category_description': category_description,
|
||||
'show_sidebar' : 'show',
|
||||
'show_topic_button': 'inline-block',
|
||||
'no_topics_message': 'hidden',
|
||||
|
||||
@@ -26,15 +26,20 @@ var express = require('express'),
|
||||
(function(app) {
|
||||
var templates = null;
|
||||
|
||||
app.build_header = function(res) {
|
||||
app.build_header = function(res, metaTags) {
|
||||
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' }
|
||||
],
|
||||
metaString = utils.buildMetaTags(defaultMetaTags.concat(metaTags || []));
|
||||
|
||||
return templates['header'].parse({
|
||||
cssSrc: global.config['theme:src'] || global.nconf.get('relative_path') + '/vendor/bootstrap/css/bootstrap.min.css',
|
||||
title: global.config['title'] || 'NodeBB',
|
||||
csrf:res.locals.csrf_token,
|
||||
relative_path: global.nconf.get('relative_path'),
|
||||
meta: {
|
||||
description: 'test'
|
||||
}
|
||||
meta_tags: metaString
|
||||
});
|
||||
};
|
||||
|
||||
@@ -157,7 +162,6 @@ var express = require('express'),
|
||||
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
|
||||
categories.getAllCategories(function(returnData) {
|
||||
res.send(
|
||||
app.build_header(res) +
|
||||
@@ -216,7 +220,10 @@ var express = require('express'),
|
||||
if(err) return res.redirect('404');
|
||||
|
||||
res.send(
|
||||
app.build_header(res) +
|
||||
app.build_header(res, [
|
||||
{ name: 'title', content: returnData.category_name },
|
||||
{ name: 'description', content: returnData.category_description }
|
||||
]) +
|
||||
'\n\t<noscript>\n' + templates['noscript/header'] + templates['noscript/category'].parse(returnData) + '\n\t</noscript>' +
|
||||
'\n\t<script>templates.ready(function(){ajaxify.go("category/' + category_url + '");});</script>' +
|
||||
templates['footer']
|
||||
|
||||
Reference in New Issue
Block a user