Created
April 22, 2014 22:40
-
-
Save bmx269/11196828 to your computer and use it in GitHub Desktop.
Meteor get site from Headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
siteData = function(){ | |
headers.ready(function() { | |
//console.log(headers.get()); | |
}); | |
var headersReady = headers.ready(); | |
if (headersReady) { | |
var host = headers.get('host'); | |
var host = String(host).replace(/^www\./,''); | |
Session.set("domain", host); | |
var domain = Session.get("domain"); | |
var theSite = Site.findOne({'domain': domain}); | |
if (theSite) { | |
var theme = theSite.siteTheme; | |
Session.set("theme", theme); | |
var title = theSite.siteTitle; | |
document.title = title; | |
return theSite; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment