diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bbf9c9021472c043b5c36383425d94e74c8f92e7..6523d0eeb2248083e287060954956496fdb8319d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,7 @@ build:
   stage: build
   script:
     - npm install
-    - npm run build -- --prefix-paths ${CI_PAGES_URL}
+    - npm run build -- --prefix-paths
   artifacts:
     paths:
       - public
diff --git a/gatsby-config.js b/gatsby-config.js
index 999bd3d349f970ae0f841a3bba9f8da0b918f21a..24d090971f00e972874df8322a36354a6efebb1e 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -1,4 +1,5 @@
 module.exports = {
+  pathPrefix:`.env.${process.env.CI_PAGES_URL}`,
   siteMetadata: {
     title: `Gatsby Default Starter`,
     description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,