Search code examples
apostrophe-cms

How to set baseUrl (also for apostrophe-multisite)


I am working on an Apostrophe project using the multisite module, and since running an npm update the _urls for pages begin with /baseUrl-not-set. I can only find this as far as documentation:

baseUrl (GLOBAL OPTION, NOT SET FOR THIS SPECIFIC MODULE) As a convenience, req.absoluteUrl is set to the absolute URL of the current request. If the baseUrl option at the top level, not for this specific module is set to a string such as http:://mysite.com, any site-wide prefix and req.url are appended to that. Otherwise the absolute URL is constructed based on the browser's request. Setting the baseUrl global option is necessary for reasonable URLs when generating markup from a command line task.

source

So, I'm not sure from there is a baseUrl property would be added to app.js (remember this is a multisite project, so it needs to be dynamic), or apostrophe-globa/index.js as a root-level property to the module, or under addFields (all of which I have tried, to no avail).

So basically since npm updating, my URL structure for all URLs is currently broken, and I can't do any deploys at the moment.

Would really appreciate some guidance here.


Solution

  • Sorry this went undocumented for a day, the instructions are now part of the module's README

    https://github.com/apostrophecms/apostrophe-multisite/blob/master/README.md#setting-baseurl-and-naming-environments