diff --git a/.gitignore b/.gitignore
index 7068c9254..9506859ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ _data/nav_api.*
_site
_config-prod.yml
_config-local.yml
+_config-environment.yml
node_modules
api
vendor
diff --git a/_includes/template/bodycontents.html b/_includes/template/bodycontents.html
index a989d61e5..57905c5bf 100644
--- a/_includes/template/bodycontents.html
+++ b/_includes/template/bodycontents.html
@@ -216,7 +216,7 @@
{% include js/prettier_changelog.js %}
{% endif %}
-{% include_remote {{ site.origin }}/_docs/footer.html css="body > *" %}
+{% include_remote {{ site.origin }}/_docs/footer.html %}
diff --git a/_includes/template/head.html b/_includes/template/head.html
index 8d946babc..10e95047f 100644
--- a/_includes/template/head.html
+++ b/_includes/template/head.html
@@ -15,7 +15,7 @@
- {% include_remote {{ site.origin }}/_docs/head.html css="head > *" %}
+ {% include_remote {{ site.origin }}/_docs/head.html %}
{% assign tinymce_script_tag_included = false %}
diff --git a/_scripts/build.sh b/_scripts/build.sh
index 6377d922f..cb77b7fd1 100755
--- a/_scripts/build.sh
+++ b/_scripts/build.sh
@@ -2,12 +2,30 @@
set -e
-BASEURL="$(_scripts/get-baseurl.sh)"
+BASE_URL="$(_scripts/get-baseurl.sh)"
+STAGING_ORIGIN="https://www.staging.tiny.cloud"
-echo -e "\n > setting baseurl to: $BASEURL"
-echo "baseurl: \"$BASEURL\"" > _config-prod.yml
+echo -e "\n > setting base url to: $BASE_URL"
+echo "baseurl: \"$BASE_URL\"" > _config-environment.yml
-echo -e " > builidng documentation\n"
-bundle exec jekyll build --config _config.yml,_config-prod.yml
+#
+# Due to how the workflow for docs builds runs in Wercker, we have
+# to check specifically for the develop branch to override the
+# origin -- we need to do this for the template imports on the
+# head, footer and newsletter parts of the docs.
+#
+if [[ -z "${WERCKER_GIT_BRANCH}" ]]; then
+ echo -e " > local build - using default origin in config.yml"
+else
+ if [[ $WERCKER_GIT_BRANCH = "develop" ]]; then
+ echo -e " > staging build - setting origin to: $STAGING_ORIGIN"
+ echo "origin: \"$STAGING_ORIGIN\"" >> _config-environment.yml
+ else
+ echo -e " > production/feature branch build - using default origin in config.yml"
+ fi
+fi
+
+echo -e " > building documentation\n"
+bundle exec jekyll build --config _config.yml,_config-environment.yml
echo ""