Use current url for API rather than hardcoding http

This exposes the base_url function to the templates to make it easier to
generate a url based on the current protocol/hostname.
Don't rely on the hosting_site_base_url being http