Skip to content

Instantly share code, notes, and snippets.

@bmx269
Created April 22, 2014 22:40
Show Gist options
  • Save bmx269/11196828 to your computer and use it in GitHub Desktop.
Save bmx269/11196828 to your computer and use it in GitHub Desktop.
Meteor get site from Headers
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