Updated to nearly fully functional. Pre-release 1. Still needs some UI changes in the slideshow and admin pages (move the save button & fix the save detection for the internship list). Customer had one more page change request which I need to re-define and handle.
This commit is contained in:
@@ -3,6 +3,8 @@ import '/imports/startup/server';
|
||||
import '/imports/startup/both';
|
||||
import '/imports/api';
|
||||
import '/imports/startup/server/postStartup/version.js'; //Run this right after the api - relies on the API to upgrade the app database & data to the current version.
|
||||
import { Picker } from 'meteor/meteorhacks:picker';
|
||||
import {SSR, Template} from "meteor/meteorhacks:ssr";
|
||||
|
||||
// let PropertiesReader = require('properties-reader');
|
||||
// let props = PropertiesReader('release.properties');
|
||||
@@ -27,3 +29,87 @@ if(process.env.MONGO_URL) {
|
||||
if(Meteor.log) Meteor.log.info(msg);
|
||||
else console.log(msg);
|
||||
}
|
||||
|
||||
const SeoRouter = Picker.filter((request, response) => {
|
||||
let botAgents = [
|
||||
/^facebookexternalhit/i, // Facebook
|
||||
/^linkedinbot/i, // LinkedIn
|
||||
/^twitterbot/i, // Twitter
|
||||
/^slackbot-linkexpanding/i // Slack
|
||||
];
|
||||
|
||||
return /_escaped_fragment_/.test(request.url) || botAgents.some(i => i.test(request.headers['user-agent']));
|
||||
});
|
||||
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
let templateMap = JSON.parse(Assets.getText('template-index'));
|
||||
let templateNames = Object.keys(templateMap);
|
||||
|
||||
templateNames.forEach(function(key) {
|
||||
//console.log(key);
|
||||
//console.log(templateMap[key]);
|
||||
//console.log("------------------------------------------------------------------------------------------------");
|
||||
SSR.compileTemplate(key, templateMap[key]);
|
||||
});
|
||||
|
||||
|
||||
//console.log(Meteor.rootPath);
|
||||
////joining path of directory
|
||||
//const directoryPath = path.join(Meteor.rootPath, 'imports/ui');
|
||||
////passing directoryPath and callback function
|
||||
//fs.readdir(directoryPath, function (err, files) {
|
||||
// //handling error
|
||||
// if(err) return console.log('Unable to scan directory: ' + err);
|
||||
// //listing all files using forEach
|
||||
////<template name="Public">
|
||||
// let templateRegex = /<template\s+name="([^"]*)>/igm;
|
||||
//
|
||||
// files.forEach(function (file) {
|
||||
// let extension = file.name.split('.').pop();
|
||||
//
|
||||
// if(extension === 'html') {
|
||||
// let html = fs.readFileSync(file, {encoding: "UTF8"});
|
||||
// let matches = html.match(templateRegex);
|
||||
// console.log(matches);
|
||||
// }
|
||||
// });
|
||||
// files.forEach(function (file) {
|
||||
// let extension = file.name.split('.').pop();
|
||||
//
|
||||
// if(extension === 'js') {
|
||||
// require(path.join(directoryPath, file.name));
|
||||
// }
|
||||
// });
|
||||
//});
|
||||
|
||||
//Prepare the server side rendering templates.
|
||||
//SSR.compileTemplate('public', Assets.getText('/imports/ui/layouts/Public.html'));
|
||||
//
|
||||
//SSR.compileTemplate('home', Assets.getText('/imports/ui/Home.html'));
|
||||
//
|
||||
//SSR.compileTemplate('currentBoard', Assets.getText('/imports/ui/CurrentBoard.html'));
|
||||
Template.CurrentBoard.helpers({
|
||||
currentBoardHTML: () => {
|
||||
//Template.instance().data
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'Board'});
|
||||
|
||||
return doc === undefined ? "" : doc.html;
|
||||
}
|
||||
});
|
||||
|
||||
SeoRouter.route('/', (params, request, response) => {
|
||||
let html = SSR.render('public', {content: 'home'});
|
||||
|
||||
response.setHeader('Content-Type', 'text/html;charset=utf-8');
|
||||
response.end(html);
|
||||
});
|
||||
|
||||
SeoRouter.route('/CurrentBoard', (params, request, response) => {
|
||||
let html = SSR.render('public', {content: 'currentBoard'});
|
||||
|
||||
response.setHeader('Content-Type', 'text/html;charset=utf-8');
|
||||
response.end(html);
|
||||
});
|
||||
Reference in New Issue
Block a user