These are chat archives for yasinuslu/blaze-meta

12th
Sep 2015
Aaron Adams
@aadamsx
Sep 12 2015 23:09

I have the following code running in the /client directory, it doesn't set the company every time on local and on my staging box I can never get the text tab to change:

  Tracker.autorun(function () {
    var config = Meteor.subscribe('public_configuration');
    if (config.ready()) {

      var company = configurations.findOne({ configuration_type: 'public' });
      console.log('meta config | company: ', company);

      if (company && company.company_name) {
        // Gets you 'Company Name' as a default title not 'Default Title'
        console.log('meta config | company name: ', company.company_name);
        Meta.config({
          options: {
            title: company.company_name,
            suffix: company.company_name
          }
        });
      }
    }
  });

I get this from the Chrome console, so I know it's picking up company name and running the code:

meta config | company:  Object
meta-tracker.js:33 meta config | company name:  Test Inc.

On initial load it will not set, then if I refresh the page the company name will get set properly. Then if I hit refresh again, it will revert back to localhost:3000. On other times it says with the company name. And this is on my local box. There seems to be no pattern for it to set the title properly.

When I deploy to staging, I can never get the tab title to change with the same code.

What am I doing wrong?