Skip to content

Instantly share code, notes, and snippets.

@ockham
Last active December 22, 2015 19:45
Show Gist options
  • Save ockham/f74ae0b6b332124360f0 to your computer and use it in GitHub Desktop.
Save ockham/f74ae0b6b332124360f0 to your computer and use it in GitHub Desktop.
diff --git a/server/pages/index.jade b/server/pages/index.jade
index f26653b..bab4888 100644
--- a/server/pages/index.jade
+++ b/server/pages/index.jade
@@ -46,8 +46,11 @@ html(lang=lang, dir=isRTL ? 'rtl' : 'ltr', class=isFluidWidth ? 'is-fluid-width'
link(rel='stylesheet', href=urls['style.css'])
body(class=isRTL ? 'rtl' : '')
- #wpcom.wpcom-site
- .wpcom-site__logo.noticon.noticon-wordpress
+ if layout
+ #wpcom.wpcom-site!= layout
+ else
+ #wpcom.wpcom-site
+ .wpcom-site__logo.noticon.noticon-wordpress
if badge
div.environment-badge
a(class='bug-report', href=feedbackURL, title='Report an issue', target='_blank')
diff --git a/server/pages/index.js b/server/pages/index.js
index bc830a7..b055671 100644
--- a/server/pages/index.js
+++ b/server/pages/index.js
@@ -5,12 +5,15 @@ var express = require( 'express' ),
execSync = require( 'child_process' ).execSync,
cookieParser = require( 'cookie-parser' ),
i18nUtils = require( 'lib/i18n-utils' ),
+ React = require( 'react' ),
+ ReactDOMServer = require( 'react-dom/server' ),
debug = require( 'debug' )( 'calypso:pages' );
var config = require( 'config' ),
sanitize = require( 'sanitize' ),
utils = require( 'bundler/utils' ),
- sections = require( '../../client/sections' );
+ sections = require( '../../client/sections' ),
+ LoggedOutLayout = require( '../../client/layout/logged-out' );
var HASH_LENGTH = 10,
URL_BASE_PATH = '/calypso',
@@ -204,6 +207,13 @@ function renderLoggedOutRoute( req, res ) {
context.i18nLocaleScript = '//widgets.wp.com/languages/calypso/' + context.lang + '.js';
}
+ const LayoutFactory = React.createFactory( LoggedOutLayout );
+ context.layout = ReactDOMServer.renderToString(
+ LayoutFactory( {
+ section: req.params.section
+ } )
+ );
+
res.render( 'index.jade', context );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment